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

refactor: Rename 'gktest' to 'gator' #1751

Merged
merged 1 commit into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmd/gator/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"runtime"
"strings"

"github.com/open-policy-agent/gatekeeper/pkg/gktest"
"github.com/open-policy-agent/gatekeeper/pkg/gator"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -89,27 +89,27 @@ func runE(cmd *cobra.Command, args []string) error {
}
targetPath = strings.Trim(targetPath, "/")

suites, err := gktest.ReadSuites(fileSystem, targetPath, recursive)
suites, err := gator.ReadSuites(fileSystem, targetPath, recursive)
if err != nil {
return fmt.Errorf("listing test files: %w", err)
}
filter, err := gktest.NewFilter(run)
filter, err := gator.NewFilter(run)
if err != nil {
return fmt.Errorf("compiling filter: %w", err)
}

return runSuites(cmd.Context(), fileSystem, suites, filter)
}

func runSuites(ctx context.Context, fileSystem fs.FS, suites []*gktest.Suite, filter gktest.Filter) error {
func runSuites(ctx context.Context, fileSystem fs.FS, suites []*gator.Suite, filter gator.Filter) error {
isFailure := false

runner, err := gktest.NewRunner(fileSystem, gktest.NewOPAClient)
runner, err := gator.NewRunner(fileSystem, gator.NewOPAClient)
if err != nil {
return err
}

results := make([]gktest.SuiteResult, len(suites))
results := make([]gator.SuiteResult, len(suites))
i := 0

for _, suite := range suites {
Expand All @@ -129,7 +129,7 @@ func runSuites(ctx context.Context, fileSystem fs.FS, suites []*gktest.Suite, fi
i++
}
w := &strings.Builder{}
printer := gktest.PrinterGo{}
printer := gator.PrinterGo{}
err = printer.Print(w, results, verbose)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/assertion.go → pkg/gator/assertion.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/client.go → pkg/gator/client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/errors.go → pkg/gator/errors.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import "errors"

Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/filter.go → pkg/gator/filter.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/filter_test.go → pkg/gator/filter_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/intstr.go → pkg/gator/intstr.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import "k8s.io/apimachinery/pkg/util/intstr"

Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/opa.go → pkg/gator/opa.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
opaclient "github.com/open-policy-agent/frameworks/constraint/pkg/client"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/printer.go → pkg/gator/printer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

// Printer knows how to print the results of running a Suite.
type Printer interface {
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/printer_go.go → pkg/gator/printer_go.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"encoding/json"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/read_suites.go → pkg/gator/read_suites.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"encoding/json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"errors"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/result.go → pkg/gator/result.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/runner.go → pkg/gator/runner.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/runner_test.go → pkg/gator/runner_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gktest/suite.go → pkg/gator/suite.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package gktest
package gator

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down