Skip to content

Commit

Permalink
OCM-7253 | feat: Refactor describe machine pool cmd to use new defaul…
Browse files Browse the repository at this point in the history
…t runner
  • Loading branch information
hunterkepley committed Apr 16, 2024
1 parent ad6095c commit a3f1fd0
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions cmd/describe/machinepool/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

const (
nodePoolName = "nodepool85"
clusterId = "24vf9iitg3p6tlml88iml6j6mu095mh8"
describeStringOutput = `
ID: nodepool85
Cluster ID: 24vf9iitg3p6tlml88iml6j6mu095mh8
Expand Down Expand Up @@ -176,7 +177,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusNotFound, ""))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", nodePoolName})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).ToNot(BeNil())
Expect(err.Error()).To(ContainSubstring(fmt.Sprintf("Machine pool '%s' not found", nodePoolName)))
})
Expand All @@ -189,7 +190,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusOK, noNodePoolUpgradePolicy))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", nodePoolName})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).To(BeNil())
})
It("Pass a machine pool name through parameter and it is found. 1 upgrade", func() {
Expand All @@ -201,7 +202,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusOK, nodePoolUpgradePolicy))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"machinepool", nodePoolName})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).To(BeNil())
})
It("Pass a machine pool name through parameter and it is found. 1 upgrade. Yaml output", func() {
Expand All @@ -214,7 +215,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusOK, nodePoolUpgradePolicy))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--output", "yaml"})
[]string{"--output", "yaml", "--machinepool", nodePoolName, "-c", clusterId})
Expect(err).To(BeNil())
})
It("Pass a machine pool name through parameter and it is found. Has AWS tags", func() {
Expand All @@ -226,7 +227,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusOK, nodePoolUpgradePolicy))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", nodePoolName})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).To(BeNil())
})
})
Expand All @@ -236,7 +237,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusNotFound, ""))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", ""})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).ToNot(BeNil())
Expect(err.Error()).To(ContainSubstring(fmt.Sprintf("Machine pool '%s' not found", nodePoolName)))
})
Expand All @@ -245,7 +246,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusNotFound, ""))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", nodePoolName})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).ToNot(BeNil())
Expect(err.Error()).To(ContainSubstring(fmt.Sprintf("Machine pool '%s' not found", nodePoolName)))
})
Expand All @@ -255,7 +256,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusOK, mpResponse))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", nodePoolName})
[]string{"--machinepool", nodePoolName, "-c", clusterId})
Expect(err).To(BeNil())
})
It("Format AWS additional security groups if exist", func() {
Expand All @@ -278,7 +279,7 @@ var _ = Describe("Upgrade machine pool", func() {
t.ApiServer.AppendHandlers(RespondWithJSON(http.StatusOK, mpResponse))
runner := DescribeMachinePoolRunner()
err := runner(context.Background(), t.RosaRuntime, NewDescribeMachinePoolCommand(),
[]string{"--machinepool", nodePoolName, "--output", "yaml"})
[]string{"--machinepool", nodePoolName, "--output", "yaml", "-c", clusterId})
Expect(err).To(BeNil())
})
})
Expand Down

0 comments on commit a3f1fd0

Please sign in to comment.