diff --git a/.github/workflows/typo-control.yml b/.github/workflows/typo-control.yml new file mode 100644 index 00000000..5bc4af07 --- /dev/null +++ b/.github/workflows/typo-control.yml @@ -0,0 +1,13 @@ +name: Typos +on: [push, pull_request] + +jobs: + run: + name: Spell Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Check for typos + uses: crate-ci/typos@v1.35.5 \ No newline at end of file diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000..b8c0387d --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default.extend-words] +Failer = "Failer" diff --git a/docs/test-cases.md b/docs/test-cases.md index 3560df76..a338b7d1 100644 --- a/docs/test-cases.md +++ b/docs/test-cases.md @@ -4,7 +4,7 @@ This document describes how one can define test cases to be used by the testing ## TestCases -Test cases objects are interpreted by the framework to build up the mock and run the tests agaisnt the configuration. +Test cases objects are interpreted by the framework to build up the mock and run the tests against the configuration. | Field | Type | Description | |-----------|-------------------------|----------------------------| diff --git a/examples/destination.yml b/examples/destination.yml index d62d3b99..78dec93f 100644 --- a/examples/destination.yml +++ b/examples/destination.yml @@ -1,4 +1,4 @@ -# This file is to test skiping non virtual services files +# This file is to test skipping non virtual services files apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: diff --git a/internal/pkg/parser/testcase.go b/internal/pkg/parser/testcase.go index dc136adb..198b3c13 100644 --- a/internal/pkg/parser/testcase.go +++ b/internal/pkg/parser/testcase.go @@ -136,7 +136,7 @@ func ParseTestCases(files []string, strict bool) ([]*TestCase, error) { var yamlFile TestCaseYAML if err := jsonDecoder.Decode(&yamlFile); err != nil { - return nil, fmt.Errorf("unmarshaling failed for file %q: %w", file, err) + return nil, fmt.Errorf("unmarshalling failed for file %q: %w", file, err) } out = append(out, yamlFile.TestCases...) diff --git a/internal/pkg/parser/testcase_test.go b/internal/pkg/parser/testcase_test.go index 1d48b18e..de03a382 100644 --- a/internal/pkg/parser/testcase_test.go +++ b/internal/pkg/parser/testcase_test.go @@ -113,7 +113,7 @@ func TestUnfoldRequest(t *testing.T) { nil, }, { - "multiple authorites and single method and URI", + "multiple authorities and single method and URI", Request{ Authority: []string{"www.example.com", "example.com", "foo.bar"}, Method: []string{"GET"}, diff --git a/internal/pkg/unit/unit.go b/internal/pkg/unit/unit.go index dde4fffe..5759cb42 100644 --- a/internal/pkg/unit/unit.go +++ b/internal/pkg/unit/unit.go @@ -45,7 +45,7 @@ func Run(testfiles, configfiles []string, strict bool) ([]string, []string, erro if testCase.Delegate != nil { if reflect.DeepEqual(route.Delegate, testCase.Delegate) != testCase.WantMatch { details = append(details, fmt.Sprintf("FAIL input:[%v]", input)) - return summary, details, fmt.Errorf("delegate missmatch=%v, want %v, rule matched: %v", route.Delegate, testCase.Delegate, route.Match) + return summary, details, fmt.Errorf("delegate mismatch=%v, want %v, rule matched: %v", route.Delegate, testCase.Delegate, route.Match) } details = append(details, fmt.Sprintf("PASS input:[%v]", input)) } @@ -66,31 +66,31 @@ func Run(testfiles, configfiles []string, strict bool) ([]string, []string, erro if testCase.Route != nil { if reflect.DeepEqual(route.Route, testCase.Route) != testCase.WantMatch { details = append(details, fmt.Sprintf("FAIL input:[%v]", input)) - return summary, details, fmt.Errorf("destination missmatch=%v, want %v, rule matched: %v", route.Route, testCase.Route, route.Match) + return summary, details, fmt.Errorf("destination mismatch=%v, want %v, rule matched: %v", route.Route, testCase.Route, route.Match) } } if testCase.Rewrite != nil { if reflect.DeepEqual(route.Rewrite, testCase.Rewrite) != testCase.WantMatch { details = append(details, fmt.Sprintf("FAIL input:[%v]", input)) - return summary, details, fmt.Errorf("rewrite missmatch=%v, want %v, rule matched: %v", route.Rewrite, testCase.Rewrite, route.Match) + return summary, details, fmt.Errorf("rewrite mismatch=%v, want %v, rule matched: %v", route.Rewrite, testCase.Rewrite, route.Match) } } if testCase.Fault != nil { if reflect.DeepEqual(route.Fault, testCase.Fault) != testCase.WantMatch { details = append(details, fmt.Sprintf("FAIL input:[%v]", input)) - return summary, details, fmt.Errorf("fault missmatch=%v, want %v, rule matched: %v", route.Fault, testCase.Fault, route.Match) + return summary, details, fmt.Errorf("fault mismatch=%v, want %v, rule matched: %v", route.Fault, testCase.Fault, route.Match) } } if testCase.Headers != nil { if reflect.DeepEqual(route.Headers, testCase.Headers) != testCase.WantMatch { details = append(details, fmt.Sprintf("FAIL input:[%v]", input)) - return summary, details, fmt.Errorf("headers missmatch=%v, want %v, rule matched: %v", route.Headers, testCase.Headers, route.Match) + return summary, details, fmt.Errorf("headers mismatch=%v, want %v, rule matched: %v", route.Headers, testCase.Headers, route.Match) } } if testCase.Redirect != nil { if reflect.DeepEqual(route.Redirect, testCase.Redirect) != testCase.WantMatch { details = append(details, fmt.Sprintf("FAIL input:[%v]", input)) - return summary, details, fmt.Errorf("redirect missmatch=%v, want %v, rule matched: %v", route.Redirect, testCase.Redirect, route.Match) + return summary, details, fmt.Errorf("redirect mismatch=%v, want %v, rule matched: %v", route.Redirect, testCase.Redirect, route.Match) } } details = append(details, fmt.Sprintf("PASS input:[%v]", input)) diff --git a/internal/pkg/unit/unit_test.go b/internal/pkg/unit/unit_test.go index 733eb4a3..6c70f80c 100644 --- a/internal/pkg/unit/unit_test.go +++ b/internal/pkg/unit/unit_test.go @@ -42,7 +42,7 @@ func TestGetRoute(t *testing.T) { { name: "no host match, empty destination", args: args{ - input: parser.Input{Authority: "www.exemple.com", URI: "/"}, + input: parser.Input{Authority: "www.example.com", URI: "/"}, virtualServices: []*v1.VirtualService{{ Spec: networking.VirtualService{ Hosts: []string{"www.another-example.com"},