-
Notifications
You must be signed in to change notification settings - Fork 243
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
Use auth info (if present) when updating pipelines #62
Conversation
Codecov Report
@@ Coverage Diff @@
## master #62 +/- ##
==========================================
+ Coverage 53.61% 54.58% +0.97%
==========================================
Files 14 14
Lines 1218 1222 +4
==========================================
+ Hits 653 667 +14
+ Misses 496 486 -10
Partials 69 69
Continue to review full report at Codecov.
|
Looks good! Can you add tests please? :) The policy is, that no code change or code goes in without tests. :) |
Sure. How should we add tests for repos that require authentication? I couldn't find any test cases in the current codebase that deal with such repos. @Skarlso @michelvocks |
@bidhan-a hmm, you'll have to take a look at the git repo framework. see how they do it in their test cases. Ultimately you can do an integration test with actual credentials. Create a test user and test repo for it. But that would a last resort I think. Otherwise, this might be a good chance to do #44 :D |
Looks good @bidhan-a 🤗 |
@Skarlso I couldn't find any test case in go-git which handles repos that require authentication 😕 It seems like we'll have to look into other options. |
@bidhan-a Crap. I'll take a look around later today. See if I can find something. |
@bidhan-a Oh wait. I think we actually don't have to. Just test this function in the three ways: First, if you provide a username and password the authentication will be that. If not, than there is a public key auth and if neither then nil, nil is returned. We don't have to test github authentication process in this PR because frankly, we don't care. It's a third party component. We can think about an integration test, but that's minuscule compared to three things we can test now. How does that sound? |
@Skarlso Yep, that sounds good to me. Thanks! 😁 |
pipeline/git_test.go
Outdated
@@ -156,3 +156,60 @@ func TestUpdateAllPipelinesHundredPipelines(t *testing.T) { | |||
t.Fatal("log output did not contain error message that the repo is up-to-date.: ", b.String()) | |||
} | |||
} | |||
|
|||
func TestGetAuthInfo(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you be so kind as to extract these into three smaller tests? Or, if you want the setup, than use t.Run("bla", func() {})
in order to have three legs in one test while still using the setups.
I was getting a lot of these errors since my pipelines are in a git repo which requires authetication
This PR should fix that.
Please let me know your thoughts.
Thanks!