Skip to content

Conversation

@JPZ13
Copy link
Collaborator

@JPZ13 JPZ13 commented Sep 17, 2025

Fixes #TODO

Please do not open a pull request until you have checked ALL of these:

  • Create the PR as draft .
  • Run make pre-commit -B to fix codegen and lint problems.
  • Sign-off your commits (otherwise the DCO check will fail).
  • Use a conventional commit message (otherwise the commit message check will fail).
  • "Fixes #" is in both the PR title (for release notes) and this description (to automatically link and close the issue).
  • Add unit or e2e tests. Say how you tested your changes. If you changed the UI, attach screenshots.
  • Github checks are green.
  • Once required tests have passed, mark your PR "Ready for review".

If changes were requested, and you've made them, dismiss the review to get it reviewed again.

Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
@JPZ13 JPZ13 requested a review from Joibel September 17, 2025 15:05
@Joibel
Copy link
Collaborator

Joibel commented Sep 17, 2025

cursor review

@cursor
Copy link

cursor bot commented Sep 17, 2025

Skipping Bugbot: Bugbot is disabled for this repository

assert.NoError(t, err)
assert.NotNil(t, location.Plugin)
// Note: SetType creates a new empty instance, not copying the values
assert.Equal(t, ArtifactPluginName(""), location.Plugin.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels like a test that proves we have a bug. I feel like we should fix the bug instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can make SetType copy the values. Would you like any other behavior along with that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Humm, OK. Let's not change SetType now I've looked properly.
I've read the code and don't understand why this function exists in the form it does, but it's doing what it's documented to do. I'd remove this test from here and move it to TestArtifactLocation_SetType in workflow_types_test.go.
It'd also be good to consider if any other tests in there want similar extending.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was expecting this to be part of the test above it in the moved location, rather than a separate test. All the other artifact drivers are tested in the same way, so making this one different implies there is a difference; but there isn't.

}

func TestArtifactLocation_MultiplePluginTypes(t *testing.T) {
t.Run("PluginTakesPrecedence", func(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Plugin doesn't seem to take precedence, this is proving that S3 takes precedence.

My preferred fix would be that configuring more than one artifact location triggers an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can update this Get method to the order that you like: https://github.com/pipekit/argo-workflows/blob/artifact-plugins/pkg/apis/workflow/v1alpha1/workflow_types.go#L1259

What is your preferred order?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not advocating for a specific order here.
The test is called "PluginTakesPrecedence", yet it proves that "S3TakesPrecedence".

My preference is that two artifact drivers is a misconfiguration and should be called out by erroring, and therefore precedence doesn't matter. Actually doing this is really out of scope. I'd suggest remove this test as it's testing for something we don't care about (precedence)

Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
@JPZ13 JPZ13 merged commit 71100ee into artifact-plugins Sep 30, 2025
3 checks passed
@JPZ13 JPZ13 deleted the 9812-unit-tests branch September 30, 2025 08:50
Joibel pushed a commit that referenced this pull request Sep 30, 2025
Fixes #TODO

Please do not open a pull request until you have checked ALL of these:

* [ ] Create the PR as draft .
* [ ] Run `make pre-commit -B` to fix codegen and lint problems.
* [ ] Sign-off your commits (otherwise the DCO check will fail).
* [ ] Use [a conventional commit
message](https://www.conventionalcommits.org/en/v1.0.0/) (otherwise the
commit message check will fail).
* [ ] "Fixes #" is in both the PR title (for release notes) and this
description (to automatically link and close the issue).
* [ ] Add unit or e2e tests. Say how you tested your changes. If you
changed the UI, attach screenshots.
* [ ] Github checks are green.
* [ ] Once required tests have passed, mark your PR "Ready for review".

If changes were requested, and you've made them, dismiss the review to
get it reviewed again.

---------

Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
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.

3 participants