Skip to content

Commit

Permalink
test: add e2e test for device update --locked=true|false
Browse files Browse the repository at this point in the history
Signed-off-by: Marques Johansson <[email protected]>
  • Loading branch information
displague committed Sep 6, 2024
1 parent f304a91 commit c6562a2
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/e2e/devices/deviceupdatetest/device_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,31 @@ func TestCli_Devices_Update(t *testing.T) {
t.Fatal(err)
}
if status == true {
root.SetArgs([]string{subCommand, "update", "-i", device.GetId(), "-H", "metal-cli-update-dev-test", "-d", "This device used for testing"})
root.SetArgs([]string{subCommand, "update", "-i", device.GetId(), "-H", "metal-cli-update-dev-test", "-d", "This device used for testing", "--locked=true"})

out := helper.ExecuteAndCaptureOutput(t, root)

if !strings.Contains(string(out[:]), "metal-cli-update-dev-test") {
t.Error("expected output should include metal-cli-update-dev-test in the out string ")
}
}

root.SetArgs([]string{subCommand, "delete", "-i", device.GetId()})

out := helper.ExecuteAndCaptureOutput(t, root)

if !strings.Contains(string(out[:]), "not delete") {

This comment has been minimized.

Copy link
@displague

displague Sep 6, 2024

Author Member

I have yet to confirm this string manually, it was a best guess. I am also assuming a failed execute (due to the error message) will be returned in out and not stderr. I'm planning to run the e2e tests locally to verify this.

t.Error("expected output should include 'not delete' in the out string due to device locking")
}

root.SetArgs([]string{subCommand, "update", "-i", device.GetId(), "--locked=false"})

out = helper.ExecuteAndCaptureOutput(t, root)

if !strings.Contains(string(out[:]), "metal-cli-update-dev-test") {
t.Error("expected output should include metal-cli-update-dev-test in the out string ")
}

},
},
}
Expand Down

0 comments on commit c6562a2

Please sign in to comment.