Skip to content

Migrates cmd tests from ginkgo,gomega to testing,testify #161

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

Merged
merged 5 commits into from
Apr 6, 2021

Conversation

codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Apr 4, 2021

This completes migration of ./pkg/cmd/... from ginkgo,gomega to
testing,testify per rationale noted in #130.

This also fixes a bug where we accidentally added ignore files into
the output directory of getenvoy extension init and backfills tests
to ensure that doesn't happen again.

elaboration on .gitignore and getenvoy extension init

Before, we added .gitignore files on getenvoy extension init. These
assume the end-user would be checking the workspaces into git. However,
the workspaces were neither initialized for git, nor the .gitignore
files complete per-language. Moreover, certain directories are subject
to variables, such as CARGO_TARGET_DIR.

This removes the .gitignore file generation completely, and with it the
duplication involved. If an end user is using our project, able to do
git init, yet want us to manage .gitignore also, we can revisit upon
such feedback later.

@@ -250,8 +210,8 @@ func requireExtensionClean(t *testing.T, workDir string) {
err := os.Chdir(workDir)
require.NoError(t, err, `error changing to directory: %v`, workDir)

cmd := getEnvoy("extension clean")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these cmd -> c changes were mainly to help avoid clashing with the package

Copy link
Member

Choose a reason for hiding this comment

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

+1


// Package morerequire includes more require functions than "github.com/stretchr/testify/require"
// Do not add dependencies on any main code as it will cause cycles.
package morerequire
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the stuff here is the same as it was, this is just pulled out to help reduce chance of package cycles

Adrian Cole added 3 commits April 6, 2021 09:16
This completes migration of ./pkg/cmd/... from ginkgo,gomega to
testing,testify per rationale noted in #130.

This also fixes a bug where we accidentally added ignore files into
the output directory of `getenvoy extension init` and backfills tests
to ensure that doesn't happen again.

Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Before, we added `.gitignore` files on `git extension init`. These
assume the end-user would be checking the workspaces into git. However,
the workspaces were neither initialized for git, nor the `.gitignore`
files complete per-language. Moreover, certain directories are subject
to variables, such as `CARGO_TARGET_DIR`.

This removes the .gitignore file generation completely, and with it the
duplication involved. If an end user is using our project, able to do
`git init`, yet want us to manage `.gitignore` also, we can revisit upon
such feedback later.

Signed-off-by: Adrian Cole <[email protected]>
@codefromthecrypt codefromthecrypt force-pushed the complete-cmd-migration branch from 7aa5fa6 to 010f67b Compare April 6, 2021 01:24
func() []TableEntry {
entries := []TableEntry{}
for _, category := range []string{"envoy.filters.http", "envoy.filters.network", "envoy.access_loggers"} {
for _, language := range []string{"rust"} {
Copy link
Member

Choose a reason for hiding this comment

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

oops, I didn't know that this is only tested for Rust, thanks

err = newParams().OutputDir.Validator(invalidPath)
Expect(err).To(MatchError(fmt.Sprintf(`stat %s: not a directory`, invalidPath)))
})
file := os.Args[0]
Copy link
Member

Choose a reason for hiding this comment

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

neat!

Copy link
Member

@mathetake mathetake left a comment

Choose a reason for hiding this comment

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

super!

@codefromthecrypt
Copy link
Contributor Author

thanks! will address the feedback shortly

Signed-off-by: Adrian Cole <[email protected]>
@codefromthecrypt codefromthecrypt merged commit fb32ea6 into master Apr 6, 2021
@codefromthecrypt
Copy link
Contributor Author

Thanks for another epic review @mathetake

@codefromthecrypt codefromthecrypt deleted the complete-cmd-migration branch April 6, 2021 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants