Conversation
Signed-off-by: Santosh Kaluskar <[email protected]>
darkowlzz
left a comment
There was a problem hiding this comment.
@Santosh1176 thanks for taking this up.
Looks like the tests pass because there's no real authentication check being performed in the git test server.
In
source-controller/controllers/gitrepository_controller_test.go
Lines 512 to 514 in decbd9f
As mentioned in #1005 (comment) , the gittestserver needs to be updated to use the new gitkit which has bearer token support and update the gitkit AuthFunc in the GitServer in https://github.com/fluxcd/pkg/blob/5382a4b12ebd84c10c63433e63e379eae6bde153/gittestserver/server.go#L153-L155 to check and compare the provided bearer token if any. May also need to add a new function, maybe with the signature
func (s *GitServer) WithBearerAuth(token string) *GitServerto set the bearer token in the GitServer similar to GitServer.Auth(). Please create a PR against https://github.com/fluxcd/pkg/ for this.
After all that, this gitrepository test can be updated to configure the gittestserver to set the bearer token when it's used in the test case.
The bearer token support in gitkit got merged a few days ago, refer fluxcd/gitkit@a88e269 . For now, you can pin the go dependency to that commit when updating the gittestserver dependencies. Once we have a tagged release, you can update it to a specific tag.
@aryan9600 can we do a new gitkit release with the bearer token support?
Add test for HTTP bearer-token auth.
This PR closes #1005