Skip to content
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/typo-control.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
2 changes: 2 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-words]
Failer = "Failer"
2 changes: 1 addition & 1 deletion docs/test-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|-----------|-------------------------|----------------------------|
Expand Down
2 changes: 1 addition & 1 deletion examples/destination.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/parser/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/parser/testcase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
12 changes: 6 additions & 6 deletions internal/pkg/unit/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/unit/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down