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 unit tests to pipelinerun_helper #8

Merged
merged 1 commit into from
Jul 22, 2024

Conversation

avi-biton
Copy link
Collaborator

Add unit tests to pipelinerun_helper

Copy link
Member

@yftacherzog yftacherzog left a comment

Choose a reason for hiding this comment

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

How does it look when one function is failing?

I was expecting the unit tests to be separated by the units (functions) being tested.

I do see some sense now with grouping them by context, which can represent a single scenario in which the different functions are called. having said that, I'd like to see that when we have a regression in one function, the results will point to that function, rather than to a case with many functions.

@avi-biton
Copy link
Collaborator Author

How does it look when one function is failing?

I was expecting the unit tests to be separated by the units (functions) being tested.

I do see some sense now with grouping them by context, which can represent a single scenario in which the different functions are called. having said that, I'd like to see that when we have a regression in one function, the results will point to that function, rather than to a case with many functions.

It is well organized when using the Context and It structure.
I failed one test so you can see how it looks.

@yftacherzog
Copy link
Member

How does it look when one function is failing?
I was expecting the unit tests to be separated by the units (functions) being tested.
I do see some sense now with grouping them by context, which can represent a single scenario in which the different functions are called. having said that, I'd like to see that when we have a regression in one function, the results will point to that function, rather than to a case with many functions.

It is well organized when using the Context and It structure. I failed one test so you can see how it looks.

ok. I'm good with that. In that case, I think the Its should mention the name of the function being tested (left a comment with an example).

@avi-biton avi-biton force-pushed the unit_tests branch 2 times, most recently from 5c0f4dc to e2d7457 Compare July 22, 2024 10:03
Comment on lines +115 to +136
result := []tektonv1.PipelineRunResult{
{
Name: "PIPELINERUN_NAME",
Value: *tektonv1.NewStructuredValues(testTruePipelineRun.Name),
},
{
Name: "IMAGE_DIGEST",
Value: *tektonv1.NewStructuredValues("image_digest_value"),
},
{
Name: "IMAGE_URL",
Value: *tektonv1.NewStructuredValues("image"),
},
{
Name: "CHAINS-GIT_URL",
Value: *tektonv1.NewStructuredValues("git_url_value"),
},
{
Name: "CHAINS-GIT_COMMIT",
Value: *tektonv1.NewStructuredValues("git_commit_value"),
},
}
Copy link
Member

Choose a reason for hiding this comment

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

Is the eventual comparison sensitive to the order of the results? If we see flakiness, we'll need to look into this again.

Copy link
Member

@yftacherzog yftacherzog left a comment

Choose a reason for hiding this comment

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

Left some minor comments

Add unit tests to pipelinerun helper

Signed-off-by: Avi Biton <[email protected]>
Copy link
Member

@yftacherzog yftacherzog left a comment

Choose a reason for hiding this comment

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

lgtm

@avi-biton avi-biton merged commit 4015e16 into konflux-ci:main Jul 22, 2024
2 checks passed
@avi-biton avi-biton deleted the unit_tests branch July 22, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants