Skip to content

feat: add unit tests for auth token#106

Merged
helayoty merged 1 commit intoAzure:mainfrom
helayoty:config-tests
Jun 21, 2022
Merged

feat: add unit tests for auth token#106
helayoty merged 1 commit intoAzure:mainfrom
helayoty:config-tests

Conversation

@helayoty
Copy link
Contributor

@helayoty helayoty commented Jun 17, 2022

Description of your changes

  • No unit tests for azure_msi. It will be covered in the integration/e2e tests
    I have:

  • Run make reviewable to ensure this PR is ready for review.

How has this code been tested

Special notes for your reviewer

@codecov
Copy link

codecov bot commented Jun 20, 2022

Codecov upload limit reached ⚠️

This org is currently on the free Basic Plan; which includes 250 free private repo uploads each rolling month. This limit has been reached and additional reports cannot be generated. For unlimited uploads, upgrade to our pro plan.

Do you have questions or need help? Connect with our sales team today at sales@codecov.io

@helayoty helayoty marked this pull request as ready for review June 20, 2022 20:47
Copy link
Member

@minhng22 minhng22 left a comment

Choose a reason for hiding this comment

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

Some minor comments. The refreshToken code I don't have good understanding right now so I could review next round but I would be slower in reviewing.

@helayoty helayoty requested a review from minhng22 June 20, 2022 23:00
@minhng22
Copy link
Member

Semantics looks good. Token writer looks good. I don't have good understanding of token refresher so please get a third eye. If by midday tomorrow no body else takes it I would dig into the code and review that part.

Copy link
Member

@minhng22 minhng22 left a comment

Choose a reason for hiding this comment

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

Semantics looks good. Token writer looks good. I don't have good understanding of token refresher so please get a third eye. If by midday tomorrow no body else takes it I would dig into the code and review that part.

}

// TestRefreshTokenOnce test to refresh/rewrite token for one time
func TestRefreshTokenOnce(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder why is this UT not following the table driven test pattern in all the other UTs in the repo?

return nil
}

func TestWriteToken(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

fs related utility function should take an interface as a parameter or use a local function var. All the added interface/factory/function pointers and the mock just to produce one test case to cover the happy case do not seem to be worth the extra code and complexity. This is not the idiomatic go way.

@helayoty helayoty merged commit 278f5ca into Azure:main Jun 21, 2022
@helayoty helayoty deleted the config-tests branch June 21, 2022 17:57
britaniar pushed a commit to britaniar/fleet that referenced this pull request Jun 16, 2025
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