Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for parsing static value with parseJSONValue func #5959

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/controllers/applicationfailover/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@ func Test_parseJSONValue(t *testing.T) {
wantErr: assert.NoError,
want: "2",
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add a comment describing what the test case does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get it from the test case get a static value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update with get a static value just as jsonPath write

name: "get a static value just as jsonPath write",
args: args{
rawStatus: []byte(`{"replicas": 2}`),
jsonPath: "true",
},
wantErr: assert.NoError,
want: "true",
},
// Build the following test cases in terms of what the function supports (which we don't use now).
// Please refer to Function Support: https://kubernetes.io/docs/reference/kubectl/jsonpath/
{
Expand Down