test: ignore rgw cli flag order in unit test

In the unit test that ensures `rgwCommandFlags` works properly, ignore
the ordering of the flags. Golang maps are used underneath, which
results in random flag ordering. This is fine as long as the
`rgwCommandFlags` are still guaranteed to be appended to the args Rook
normally applies.

Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
This commit is contained in:
Blaine Gardner committed 2024-12-17 12:21:50 -07:00
1 parent 92c95fcc16
commit 37c3cc9fba
1 file changed
+5 -3
+5 -3
View File
@@ -982,10 +982,12 @@ func TestRgwCommandFlags(t *testing.T) {
}
rgwContainer, err := c.makeDaemonContainer(rgwConfig)
assert.NoError(t, err)
// ordering of additional args amongst themselves doesn't matter (and is random b/c of
// underlying map data type), but it is still important that the additional args are always
// after the args Rook normally applies
l := len(rgwContainer.Args)
assert.Equal(t, "--rgw-option=val spaced", rgwContainer.Args[l-3])
assert.Equal(t, "--rgw-option=val-dashed", rgwContainer.Args[l-2])
assert.Equal(t, "--rgw-option=val_underscored", rgwContainer.Args[l-1])
addedArgs := rgwContainer.Args[l-3:]
assert.ElementsMatch(t, []string{"--rgw-option=val spaced", "--rgw-option=val-dashed", "--rgw-option=val_underscored"}, addedArgs)
})
}