X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b6d7efab2c4bffa3fabd55b166e44cca8ac1391f..fb553cae8d2132a17bc31d06d7b5f95aeebff78a:/lib/cloud/azure/azure_test.go diff --git a/lib/cloud/azure/azure_test.go b/lib/cloud/azure/azure_test.go index 94af0b9a26..b6aa9a16b6 100644 --- a/lib/cloud/azure/azure_test.go +++ b/lib/cloud/azure/azure_test.go @@ -47,7 +47,7 @@ import ( "git.arvados.org/arvados.git/lib/dispatchcloud/test" "git.arvados.org/arvados.git/sdk/go/arvados" "git.arvados.org/arvados.git/sdk/go/config" - "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2018-06-01/compute" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2018-06-01/network" "github.com/Azure/azure-sdk-for-go/storage" "github.com/Azure/go-autorest/autorest" @@ -127,7 +127,7 @@ var live = flag.String("live-azure-cfg", "", "Test with real azure API, provide func GetInstanceSet() (cloud.InstanceSet, cloud.ImageID, arvados.Cluster, error) { cluster := arvados.Cluster{ InstanceTypes: arvados.InstanceTypeMap(map[string]arvados.InstanceType{ - "tiny": arvados.InstanceType{ + "tiny": { Name: "tiny", ProviderType: "Standard_D1_v2", VCPUs: 1, @@ -136,6 +136,15 @@ func GetInstanceSet() (cloud.InstanceSet, cloud.ImageID, arvados.Cluster, error) Price: .02, Preemptible: false, }, + "tinyp": { + Name: "tiny", + ProviderType: "Standard_D1_v2", + VCPUs: 1, + RAM: 4000000000, + Scratch: 10000000000, + Price: .002, + Preemptible: true, + }, })} if *live != "" { var exampleCfg testConfig @@ -156,6 +165,7 @@ func GetInstanceSet() (cloud.InstanceSet, cloud.ImageID, arvados.Cluster, error) logger: logrus.StandardLogger(), deleteNIC: make(chan string), deleteBlob: make(chan storage.Blob), + deleteDisk: make(chan compute.Disk), } ap.ctx, ap.stopFunc = context.WithCancel(context.Background()) ap.vmClient = &VirtualMachinesClientStub{} @@ -184,6 +194,17 @@ func (*AzureInstanceSetSuite) TestCreate(c *check.C) { c.Check(tags["TestTagName"], check.Equals, "test tag value") c.Logf("inst.String()=%v Address()=%v Tags()=%v", inst.String(), inst.Address(), tags) + instPreemptable, err := ap.Create(cluster.InstanceTypes["tinyp"], + img, map[string]string{ + "TestTagName": "test tag value", + }, "umask 0600; echo -n test-file-data >/var/run/test-file", pk) + + c.Assert(err, check.IsNil) + + tags = instPreemptable.Tags() + c.Check(tags["TestTagName"], check.Equals, "test tag value") + c.Logf("instPreemptable.String()=%v Address()=%v Tags()=%v", instPreemptable.String(), instPreemptable.Address(), tags) + } func (*AzureInstanceSetSuite) TestListInstances(c *check.C) { @@ -258,7 +279,7 @@ func (*AzureInstanceSetSuite) TestWrapError(c *check.C) { DetailedError: autorest.DetailedError{ Response: &http.Response{ StatusCode: 429, - Header: map[string][]string{"Retry-After": []string{"123"}}, + Header: map[string][]string{"Retry-After": {"123"}}, }, }, ServiceError: &azure.ServiceError{},