-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
256 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: {} | ||
concurrency: ${{ github.ref }} | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
id-token: write | ||
|
||
jobs: | ||
test: | ||
runs-on: [ubuntu-latest] | ||
steps: | ||
- name: checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v6 | ||
|
||
- name: tests | ||
run: | | ||
go test -vet=off -timeout 10m ./... -count=1 -race -v -p 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
run: | ||
timeout: 10m | ||
linters: | ||
disable-all: true | ||
enable: | ||
- errcheck | ||
- gofumpt | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- staticcheck | ||
- stylecheck | ||
- typecheck | ||
- unused |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @getyourguide/sre @gygrobot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,63 @@ | ||
package filters_test | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"testing" | ||
"time" | ||
|
||
"github.com/getyourguide/extproc-go/examples/filters" | ||
"github.com/getyourguide/extproc-go/server" | ||
extproctest "github.com/getyourguide/extproc-go/test" | ||
"github.com/getyourguide/extproc-go/test/containers/envoy" | ||
"github.com/stretchr/testify/require" | ||
"github.com/stretchr/testify/suite" | ||
) | ||
|
||
func TestSameSiteLax(t *testing.T) { | ||
func TestFilters(t *testing.T) { | ||
suite.Run(t, &FiltersTestSuite{}) | ||
} | ||
|
||
type FiltersTestSuite struct { | ||
suite.Suite | ||
container *envoy.TestContainer | ||
url string | ||
ctx context.Context | ||
} | ||
|
||
func (suite *FiltersTestSuite) SetupSuite() { | ||
suite.ctx = context.Background() | ||
suite.container = envoy.NewTestContainer() | ||
if err := suite.container.Run(suite.ctx, "istio/proxyv2:1.24.2"); err != nil { | ||
log.Fatal(err) | ||
} | ||
suite.url = suite.container.URL.String() | ||
} | ||
|
||
func (suite *FiltersTestSuite) TearDownSuite() { | ||
if err := suite.container.Terminate(suite.ctx); err != nil { | ||
log.Fatalf("error terminating postgres container: %s", err) | ||
} | ||
} | ||
|
||
func (suite *FiltersTestSuite) TestSameSiteLaxMode() { | ||
t := suite.T() | ||
srv := server.New(context.Background(), | ||
server.WithEcho(), | ||
server.WithFilters(&filters.SameSiteLaxMode{}), | ||
) | ||
|
||
errCh := make(chan error, 1) | ||
go func() { | ||
errCh <- srv.Serve() | ||
}() | ||
err := server.WaitReady(srv, 10*time.Second) | ||
require.NoError(t, err) | ||
|
||
tc := extproctest.Load(t, "testdata/setcookie.yml") | ||
tc.Run(t) | ||
tc.Run(t, extproctest.WithURL(suite.url)) | ||
|
||
require.NoError(t, srv.Stop()) | ||
err = <-errCh | ||
require.NoError(t, err) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,5 +199,4 @@ func NewRequestContext() *RequestContext { | |
} | ||
|
||
return req | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.