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

Switch from Ginkgo to stdlib testing #57

Merged
merged 9 commits into from
Nov 14, 2023
Merged

Switch from Ginkgo to stdlib testing #57

merged 9 commits into from
Nov 14, 2023

Conversation

particledecay
Copy link
Owner

refactor: switch all of kconf to stdlib testing pkg

What? (description)

This PR switches the entire kconf project to using the Go testing package for testing.

NOTE: This refactoring found a few issues in existing functionality which forced some changes to the code. Namely, the previous version would rename an existing context even if the underlying configs were equal, and this was due to the method of making those comparisons. This is no longer the case and kconf will not re-add an identical context unless there are some changes. This is probably fine for most people but in the end it could be an unexpected change. Therefore, this will be released as a major version bump.

  • refactor: switch add_test to testing pkg
  • refactor: switch multiple test files to testing pkg
  • refactor: all of cmd to use testing library instead of ginkgo
  • refactor: move most of pkg/kubeconfig to testing pkg
  • refactor: convert most of kubeconfig to testing pkg
  • refactor: switch all of kubeconfig to testing pkg
  • refactor: cleanup remaining ginkgo items
  • chore: add tool-versions file for asdf

Why? (reasoning)

The switch to Ginkgo v2 turned out to be more maintenance than desired, and the testing pkg is more than sufficient for the needs of this project, especially with more recent updates involving test shuffling and cleanup.

GitHub Issue (if applicable)

Acceptance

Check your PR for the following:

  • you included tests
  • you linted your code
  • your PR has only one commit (interactive rebase!)
  • your commit message follows Conventional Commit format
  • you are not reducing the total test coverage

@particledecay particledecay marked this pull request as ready for review November 14, 2023 21:45
@@ -90,16 +109,34 @@ func (k *KConf) AddUser(name string, user *clientcmdapi.AuthInfo) string {
return name
}

// IsEqualUser checks whether two Users are equal
func IsEqualUser(user1, user2 *clientcmdapi.AuthInfo) bool {
if user1.ClientCertificate != user2.ClientCertificate ||
Copy link

Choose a reason for hiding this comment

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

Consider simplifying this complex logical expression.

Copy link

codeclimate bot commented Nov 14, 2023

Code Climate has analyzed commit 80d3a5a and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 1

Note: there is 1 critical issue.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 75.7% (1.9% change).

View more on Code Climate.

@particledecay particledecay merged commit 4621b5f into main Nov 14, 2023
3 checks passed
@particledecay particledecay deleted the use_testing branch November 14, 2023 22:07
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.

1 participant