Skip to content

Commit

Permalink
OCM-9600 | ci: fix id:57102
Browse files Browse the repository at this point in the history
update
  • Loading branch information
xueli181114 committed Jul 15, 2024
1 parent 88d9d11 commit 088ed9c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/e2e/test_rosacli_machine_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,15 @@ var _ = Describe("Edit machinepool",
workerPool := mpList.Machinepool(con.DefaultClassicWorkerPool)
Expect(workerPool).ToNot(BeNil())

By("Prepare an additional machinepool to make sure the taint edit can work")
_, err = rosaClient.MachinePool.CreateMachinePool(
clusterID,
"mp-57102",
"--replicas", "3",
)
Expect(err).ToNot(HaveOccurred())
defer rosaClient.MachinePool.DeleteMachinePool(clusterID, "mp-57102")

labels_1 := "m5.xlarge/test=aaa"
taints_1 := "Key1=:NoExecute"
labels_2 := "aaa="
Expand All @@ -909,6 +918,13 @@ var _ = Describe("Edit machinepool",
"empty_label_and_taint": {"--labels", "", "--taints", ""},
}

// define the recovery step
defer machinePoolService.EditMachinePool(clusterID,
con.DefaultClassicWorkerPool,
"--labels", common.ReplaceCommaSpaceWithComma(workerPool.Labels),
"--taints", common.ReplaceCommaSpaceWithComma(workerPool.Taints),
)

for key, flags := range reqFlags {
By("Edit machinepools to the cluster")
_, err := machinePoolService.EditMachinePool(clusterID, con.DefaultClassicWorkerPool, flags...)
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/test_rosacli_oidc_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ var _ = Describe("Register ummanaged oidc config testing",
_, err := rosaClient.Runner.RunCMD(strings.Split(command, " "))
Expect(err).To(BeNil())
}
Expect(secretArn).ToNot(BeEmpty(), "secretArn is empty which will block coming steps.")

By("Register oidc config")
_, err = ocmResourceService.RegisterOIDCConfig(
Expand Down
9 changes: 9 additions & 0 deletions tests/utils/exec/rosacli/cmd_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ func (r *runner) Run() (bytes.Buffer, error) {
cmd.Stderr = cmd.Stdout

err = cmd.Run()
if err != nil {
err = fmt.Errorf("%s: %s", err.Error(), output.String())
}
if common.SliceContains(cmdElements, "access_token") ||
common.SliceContains(cmdElements, "token") ||
common.SliceContains(cmdElements, "refresh_token") {
Expand Down Expand Up @@ -224,6 +227,9 @@ func (r *runner) RunCMD(command []string) (bytes.Buffer, error) {
cmd.Stderr = cmd.Stdout

err = cmd.Run()
if err != nil {
err = fmt.Errorf("%s: %s", err.Error(), output.String())
}
log.Logger.Debugf("Get Combining Stdout and Stderr is : %s", output.String())

return output, err
Expand All @@ -235,17 +241,20 @@ func (r *runner) RunPipeline(commands ...[]string) (bytes.Buffer, error) {
var err error

cmds := make([]*exec.Cmd, len(commands))

for i, command := range commands {
cmds[i] = exec.Command(command[0], command[1:]...) // #nosec G204
if i > 0 {
cmds[i].Stdin, _ = cmds[i-1].StdoutPipe()
}
cmds[i].Stderr = &output

}

cmds[len(cmds)-1].Stdout = &output

for _, cmd := range cmds {
log.Logger.Infof("Running commands: %s", cmd.String())
if err = cmd.Start(); err != nil {
return output, fmt.Errorf("starting %v: %v", cmd.Args, err)
}
Expand Down

0 comments on commit 088ed9c

Please sign in to comment.