Skip to content

Commit

Permalink
test fixes WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhooker committed Jan 25, 2018
1 parent 5d48d65 commit 8cd4034
Show file tree
Hide file tree
Showing 62 changed files with 242 additions and 181 deletions.
7 changes: 4 additions & 3 deletions builder/azure/arm/step_capture_image_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"fmt"
"testing"

Expand All @@ -26,7 +27,7 @@ func TestStepCaptureImageShouldFailIfCaptureFails(t *testing.T) {

stateBag := createTestStateBagStepCaptureImage()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -51,7 +52,7 @@ func TestStepCaptureImageShouldPassIfCapturePasses(t *testing.T) {

stateBag := createTestStateBagStepCaptureImage()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand Down Expand Up @@ -91,7 +92,7 @@ func TestStepCaptureImageShouldTakeStepArgumentsFromStateBag(t *testing.T) {
}

stateBag := createTestStateBagStepCaptureImage()
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down
15 changes: 8 additions & 7 deletions builder/azure/arm/step_create_resource_group_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"errors"
"fmt"
"testing"
Expand All @@ -26,7 +27,7 @@ func TestStepCreateResourceGroupShouldFailIfBothGroupNames(t *testing.T) {
error: func(e error) {},
exists: func(string) (bool, error) { return false, nil },
}
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -46,7 +47,7 @@ func TestStepCreateResourceGroupShouldFailIfCreateFails(t *testing.T) {

stateBag := createTestStateBagStepCreateResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -66,7 +67,7 @@ func TestStepCreateResourceGroupShouldFailIfExistsFails(t *testing.T) {

stateBag := createTestStateBagStepCreateResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -86,7 +87,7 @@ func TestStepCreateResourceGroupShouldPassIfCreatePasses(t *testing.T) {

stateBag := createTestStateBagStepCreateResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand Down Expand Up @@ -114,7 +115,7 @@ func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T
}

stateBag := createTestStateBagStepCreateResourceGroup()
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down Expand Up @@ -152,7 +153,7 @@ func TestStepCreateResourceGroupMarkShouldFailIfTryingExistingButDoesntExist(t *

stateBag := createTestExistingStateBagStepCreateResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -172,7 +173,7 @@ func TestStepCreateResourceGroupMarkShouldFailIfTryingTempButExist(t *testing.T)

stateBag := createTestStateBagStepCreateResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand Down
19 changes: 10 additions & 9 deletions builder/azure/arm/step_delete_os_disk_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"errors"
"fmt"
"testing"
Expand All @@ -19,7 +20,7 @@ func TestStepDeleteOSDiskShouldFailIfGetFails(t *testing.T) {

stateBag := DeleteTestStateBagStepDeleteOSDisk("http://storage.blob.core.windows.net/images/pkrvm_os.vhd")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -38,7 +39,7 @@ func TestStepDeleteOSDiskShouldPassIfGetPasses(t *testing.T) {

stateBag := DeleteTestStateBagStepDeleteOSDisk("http://storage.blob.core.windows.net/images/pkrvm_os.vhd")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand All @@ -63,7 +64,7 @@ func TestStepDeleteOSDiskShouldTakeStepArgumentsFromStateBag(t *testing.T) {
}

stateBag := DeleteTestStateBagStepDeleteOSDisk("http://storage.blob.core.windows.net/images/pkrvm_os.vhd")
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down Expand Up @@ -93,7 +94,7 @@ func TestStepDeleteOSDiskShouldHandleComplexStorageContainerNames(t *testing.T)
}

stateBag := DeleteTestStateBagStepDeleteOSDisk("http://storage.blob.core.windows.net/abc/def/pkrvm_os.vhd")
testSubject.Run(stateBag)
testSubject.Run(context.Background(), stateBag)

if actualStorageContainerName != "abc" {
t.Fatalf("Expected the storage container name to be 'abc/def', but found '%s'.", actualStorageContainerName)
Expand All @@ -115,7 +116,7 @@ func TestStepDeleteOSDiskShouldFailIfVHDNameCannotBeURLParsed(t *testing.T) {
// Invalid URL per https://golang.org/src/net/url/url_test.go
stateBag := DeleteTestStateBagStepDeleteOSDisk("http://[fe80::1%en0]/")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%v'.", result)
}
Expand All @@ -134,7 +135,7 @@ func TestStepDeleteOSDiskShouldFailIfVHDNameIsTooShort(t *testing.T) {

stateBag := DeleteTestStateBagStepDeleteOSDisk("storage.blob.core.windows.net/abc")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -157,7 +158,7 @@ func TestStepDeleteOSDiskShouldPassIfManagedDiskInTempResourceGroup(t *testing.T
stateBag.Put(constants.ArmIsExistingResourceGroup, false)
stateBag.Put(constants.ArmResourceGroupName, "testgroup")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand All @@ -181,7 +182,7 @@ func TestStepDeleteOSDiskShouldFailIfManagedDiskInExistingResourceGroupFailsToDe
stateBag.Put(constants.ArmIsExistingResourceGroup, true)
stateBag.Put(constants.ArmResourceGroupName, "testgroup")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -205,7 +206,7 @@ func TestStepDeleteOSDiskShouldFailIfManagedDiskInExistingResourceGroupIsDeleted
stateBag.Put(constants.ArmIsExistingResourceGroup, true)
stateBag.Put(constants.ArmResourceGroupName, "testgroup")

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand Down
7 changes: 4 additions & 3 deletions builder/azure/arm/step_delete_resource_group_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"fmt"
"testing"

Expand All @@ -17,7 +18,7 @@ func TestStepDeleteResourceGroupShouldFailIfDeleteFails(t *testing.T) {

stateBag := DeleteTestStateBagStepDeleteResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -36,7 +37,7 @@ func TestStepDeleteResourceGroupShouldPassIfDeletePasses(t *testing.T) {

stateBag := DeleteTestStateBagStepDeleteResourceGroup()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand All @@ -56,7 +57,7 @@ func TestStepDeleteResourceGroupShouldDeleteStateBagArmResourceGroupCreated(t *t
}

stateBag := DeleteTestStateBagStepDeleteResourceGroup()
testSubject.Run(stateBag)
testSubject.Run(context.Background(), stateBag)

value, ok := stateBag.GetOk(constants.ArmIsResourceGroupCreated)
if !ok {
Expand Down
7 changes: 4 additions & 3 deletions builder/azure/arm/step_deploy_template_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"fmt"
"testing"

Expand All @@ -19,7 +20,7 @@ func TestStepDeployTemplateShouldFailIfDeployFails(t *testing.T) {

stateBag := createTestStateBagStepDeployTemplate()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -38,7 +39,7 @@ func TestStepDeployTemplateShouldPassIfDeployPasses(t *testing.T) {

stateBag := createTestStateBagStepDeployTemplate()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand All @@ -65,7 +66,7 @@ func TestStepDeployTemplateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
}

stateBag := createTestStateBagStepValidateTemplate()
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down
7 changes: 4 additions & 3 deletions builder/azure/arm/step_get_certificate_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"fmt"
"testing"

Expand All @@ -18,7 +19,7 @@ func TestStepGetCertificateShouldFailIfGetFails(t *testing.T) {

stateBag := createTestStateBagStepGetCertificate()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -38,7 +39,7 @@ func TestStepGetCertificateShouldPassIfGetPasses(t *testing.T) {

stateBag := createTestStateBagStepGetCertificate()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand All @@ -65,7 +66,7 @@ func TestStepGetCertificateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
}

stateBag := createTestStateBagStepGetCertificate()
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down
7 changes: 4 additions & 3 deletions builder/azure/arm/step_get_ip_address_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"fmt"
"testing"

Expand All @@ -21,7 +22,7 @@ func TestStepGetIPAddressShouldFailIfGetFails(t *testing.T) {

stateBag := createTestStateBagStepGetIPAddress()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -45,7 +46,7 @@ func TestStepGetIPAddressShouldPassIfGetPasses(t *testing.T) {

stateBag := createTestStateBagStepGetIPAddress()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand Down Expand Up @@ -77,7 +78,7 @@ func TestStepGetIPAddressShouldTakeStepArgumentsFromStateBag(t *testing.T) {
}

stateBag := createTestStateBagStepGetIPAddress()
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down
7 changes: 4 additions & 3 deletions builder/azure/arm/step_get_os_disk_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package arm

import (
"context"
"fmt"
"testing"

Expand All @@ -22,7 +23,7 @@ func TestStepGetOSDiskShouldFailIfGetFails(t *testing.T) {

stateBag := createTestStateBagStepGetOSDisk()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionHalt {
t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
}
Expand All @@ -43,7 +44,7 @@ func TestStepGetOSDiskShouldPassIfGetPasses(t *testing.T) {

stateBag := createTestStateBagStepGetOSDisk()

var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)
if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
}
Expand All @@ -69,7 +70,7 @@ func TestStepGetOSDiskShouldTakeValidateArgumentsFromStateBag(t *testing.T) {
}

stateBag := createTestStateBagStepGetOSDisk()
var result = testSubject.Run(stateBag)
var result = testSubject.Run(context.Background(), stateBag)

if result != multistep.ActionContinue {
t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
Expand Down
Loading

0 comments on commit 8cd4034

Please sign in to comment.