Skip to content

Commit

Permalink
fix vmmanagers unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yharish991 committed Nov 7, 2024
1 parent 23fd367 commit ce839b1
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions vmlifecycle/vmmanagers/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -734,22 +734,19 @@ opsman-configuration:
configFileContents = readAWSConfigFile(env)
return nil, nil, errors.New("lemon")
}
When("calling CreateVM", func() {
_, _, err := manager.CreateVM()
Expect(err).To(MatchError(HaveSuffix("lemon")))
Expect(configFileContents).To(Equal(expectedConfig))
Expect(runner.ExecuteWithEnvVarsCallCount()).NotTo(BeZero())
_, args := runner.ExecuteWithEnvVarsArgsForCall(0)
if expectedProfileName != "" {
Expect(fmt.Sprintf("%v", args)).To(ContainSubstring(fmt.Sprintf("--profile %s", expectedProfileName)))
}
})

When("calling DeleteVM", func() {
err := manager.DeleteVM()
Expect(err).To(MatchError(HaveSuffix("lemon")))
Expect(configFileContents).To(Equal(expectedConfig))
})
_, _, err := manager.CreateVM()
Expect(err).To(MatchError(HaveSuffix("lemon")))
Expect(configFileContents).To(Equal(expectedConfig))
Expect(runner.ExecuteWithEnvVarsCallCount()).NotTo(BeZero())
_, args := runner.ExecuteWithEnvVarsArgsForCall(0)
if expectedProfileName != "" {
Expect(fmt.Sprintf("%v", args)).To(ContainSubstring(fmt.Sprintf("--profile %s", expectedProfileName)))
}

err = manager.DeleteVM()
Expect(err).To(MatchError(HaveSuffix("lemon")))
Expect(configFileContents).To(Equal(expectedConfig))

},
Entry("for instance profile ", vmmanagers.AWSConfig{
Expand Down

0 comments on commit ce839b1

Please sign in to comment.