new IP allocator and add postgres to integration tests. (#1756)

This commit is contained in:
Kristoffer Dalby 2024-02-18 19:31:29 +01:00 committed by GitHub
parent f581d4d9c0
commit 384ca03208
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
119 changed files with 3686 additions and 443 deletions

View file

@ -68,12 +68,13 @@ jobs:
--volume $PWD:$PWD -w $PWD/integration \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume $PWD/control_logs:/tmp/control \
--env HEADSCALE_INTEGRATION_POSTGRES={{ if .Postgres }}1{{ else }}0{{ end }} \
golang:1 \
go run gotest.tools/gotestsum@latest -- ./... \
-failfast \
-timeout 120m \
-parallel 1 \
-run "^{{.Name}}$"
-run "^{{.Test}}$"
- uses: actions/upload-artifact@v3
if: always() && steps.changed-files.outputs.any_changed == 'true'
@ -145,7 +146,9 @@ func findTests() []string {
func main() {
type testConfig struct {
Name string
Name string
Test string
Postgres bool
}
tests := findTests()
@ -153,21 +156,30 @@ func main() {
removeTests()
for _, test := range tests {
log.Printf("generating workflow for %s", test)
for _, postgres := range []bool{false, true} {
log.Printf("generating workflow for %s", test)
var content bytes.Buffer
name := test
if postgres {
name = test + "-postgres"
}
if err := jobTemplate.Execute(&content, testConfig{
Name: test,
}); err != nil {
log.Fatalf("failed to render template: %s", err)
}
var content bytes.Buffer
testPath := path.Join(githubWorkflowPath, fmt.Sprintf(jobFileNameTemplate, test))
if err := jobTemplate.Execute(&content, testConfig{
Name: name,
Test: test,
Postgres: postgres,
}); err != nil {
log.Fatalf("failed to render template: %s", err)
}
err := os.WriteFile(testPath, content.Bytes(), workflowFilePerm)
if err != nil {
log.Fatalf("failed to write github job: %s", err)
testPath := path.Join(githubWorkflowPath, fmt.Sprintf(jobFileNameTemplate, name))
err := os.WriteFile(testPath, content.Bytes(), workflowFilePerm)
if err != nil {
log.Fatalf("failed to write github job: %s", err)
}
}
}
}