-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:rudderlabs/rudder-transformer in…
…to dependabot/npm_and_yarn/aws-sdk/client-personalize-3.616.0
- Loading branch information
Showing
176 changed files
with
12,382 additions
and
1,200 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
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 |
---|---|---|
|
@@ -12,7 +12,7 @@ jobs: | |
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].1 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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 |
---|---|---|
|
@@ -16,7 +16,7 @@ jobs: | |
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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 |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Go | ||
uses: actions/[email protected].0 | ||
uses: actions/[email protected].2 | ||
with: | ||
go-version: 1.17 | ||
|
||
|
@@ -26,7 +26,7 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
fetch-depth: 1 | ||
|
||
- name: Setup Node | ||
uses: actions/[email protected].2 | ||
uses: actions/[email protected].3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'npm' | ||
|
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
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
go.work | ||
go.work.sum |
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,23 @@ | ||
# GO libraries | ||
|
||
## webhook/testdata | ||
|
||
To generate the test files use: | ||
|
||
```bash | ||
go generate ./... | ||
``` | ||
|
||
Work against local rudder-server: | ||
|
||
```bash | ||
go work init | ||
go work use . | ||
go work use ../../rudder-server | ||
``` | ||
|
||
Then run the webhook tests: | ||
|
||
```bash | ||
go test github.com/rudderlabs/rudder-server/gateway/webhook -count 1 -timeout 2m | ||
``` |
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,11 @@ | ||
module github.com/rudderlabs/rudder-transformer/go | ||
|
||
go 1.22.4 | ||
|
||
require github.com/stretchr/testify v1.9.0 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
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,9 @@ | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= | ||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
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,99 @@ | ||
package testcases | ||
|
||
import ( | ||
"embed" | ||
"encoding/json" | ||
"io/fs" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
type Setup struct { | ||
Context Context | ||
Cases []Case | ||
} | ||
|
||
type Context struct { | ||
Now time.Time | ||
RequestIP string `json:"request_ip"` | ||
} | ||
|
||
type Case struct { | ||
Name string | ||
Description string | ||
Skip string | ||
Input Input | ||
Output Output | ||
} | ||
|
||
type Input struct { | ||
Request Request | ||
} | ||
type Request struct { | ||
Method string | ||
RawQuery string `json:"query"` | ||
Headers map[string]string | ||
Body json.RawMessage | ||
} | ||
|
||
type Output struct { | ||
Response Response | ||
Queue []json.RawMessage | ||
ErrQueue []json.RawMessage `json:"err_queue"` | ||
} | ||
|
||
type Response struct { | ||
Body json.RawMessage | ||
StatusCode int `json:"status"` | ||
} | ||
|
||
//go:generate npx ts-node ../../../test/scripts/generateJson.ts sources ./testdata/testcases | ||
//go:generate npx prettier --write ./testdata/**/*.json | ||
|
||
//go:embed testdata/context.json | ||
var contextData []byte | ||
|
||
//go:embed testdata/testcases/**/*.json | ||
var testdata embed.FS | ||
|
||
func Load(t *testing.T) Setup { | ||
t.Helper() | ||
|
||
var tc Context | ||
err := json.Unmarshal(contextData, &tc) | ||
require.NoError(t, err) | ||
|
||
var tcs []Case | ||
err = fs.WalkDir(testdata, ".", func(path string, d fs.DirEntry, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if d.IsDir() { | ||
return nil | ||
} | ||
|
||
f, err := testdata.Open(path) | ||
if err != nil { | ||
return err | ||
} | ||
defer f.Close() | ||
|
||
var tc Case | ||
err = json.NewDecoder(f).Decode(&tc) | ||
if err != nil { | ||
return err | ||
} | ||
tcs = append(tcs, tc) | ||
|
||
return nil | ||
}) | ||
require.NoError(t, err) | ||
|
||
return Setup{ | ||
Context: tc, | ||
Cases: tcs, | ||
} | ||
} |
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,5 @@ | ||
{ | ||
"request_ip_comment": "192.0.2.x/24 - This block is assigned as \"TEST-NET\" for use in documentation and example code.", | ||
"request_ip": "192.0.2.30", | ||
"now": "2024-03-03T04:48:29.000Z" | ||
} |
Oops, something went wrong.