Skip to content

Commit

Permalink
Enabled missing integration tests and added to the pipelines
Browse files Browse the repository at this point in the history
Signed-off-by: David Gannon <[email protected]>
  • Loading branch information
dgannon991 committed Jan 2, 2025
1 parent 3784a2c commit 570d37e
Show file tree
Hide file tree
Showing 24 changed files with 350 additions and 205 deletions.
149 changes: 32 additions & 117 deletions .github/workflows/porter-integration-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,124 +93,39 @@ jobs:
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: telemetry_test
# Reusable workflows only supports 20 jobs
uninstall_test_integ:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: uninstall_test.go
run: go run mage.go -v TestIntegration
shell: bash
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: uninstall_test
signing_test_integ:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: signing_test.go
run: go run mage.go -v TestIntegration
shell: bash
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: signing_test
upgrade_test_integ:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: upgrade_test.go
run: go run mage.go -v TestIntegration
shell: bash
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: upgrade_test
plugin_log_level_test_integ:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: plugin_log_level_test.go
run: go run mage.go -v TestIntegration
shell: bash
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: plugin_log_level_test
porter_build_integration_test:
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: build_integration_test
lifecycle_integration_test:
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: lifecycle_integration_test
pkgmgmt_integration_test:
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: pkgmgmt_integration_test
runner_integration_test:
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: runner_integration_test
agent_integration_test:
uses: getporter/porter/.github/workflows/integ-reuseable-workflow.yml@main
with:
test_name: agent_integration_test
150 changes: 150 additions & 0 deletions .github/workflows/porter-integration-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,153 @@ jobs:
PORTER_INTEG_FILE: plugin_log_level_test.go
run: go run mage.go -v TestIntegration
shell: bash
porter_build_integration_test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: build_integration_test.go
run: go run mage.go -v TestIntegration
shell: bash
lifecycle_integration_test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: lifecycle_integration_test.go
run: go run mage.go -v TestIntegration
shell: bash
pkgmgmt_integration_test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: pkgmgmt_integration_test.go
run: go run mage.go -v TestIntegration
shell: bash
runner_integration_test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: runner_integration_test.go
run: go run mage.go -v TestIntegration
shell: bash
agent_integration_test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/[email protected]
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GOVERSION }}"
cache: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
- name: Docker Login
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Agent
run: go run mage.go build
shell: bash
- name: Integration Test
env:
PORTER_INTEG_FILE: agent_integration_test.go
run: go run mage.go -v TestIntegration
shell: bash
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ require (
go.opentelemetry.io/otel v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.33.0
go.opentelemetry.io/otel/sdk v1.33.0
go.opentelemetry.io/otel/trace v1.33.0
go.uber.org/zap v1.27.0
golang.org/x/sync v0.10.0
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.0
google.golang.org/protobuf v1.36.1
gopkg.in/AlecAivazis/survey.v1 v1.8.8
gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473
gopkg.in/yaml.v3 v3.0.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 h1:5pojmb1U1AogINhN3SurB+zm/nIcusopeBNp42f45QM=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0/go.mod h1:57gTHJSE5S1tqg+EKsLPlTWhpHMsWlVmer+LA926XiA=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0 h1:cMyu9O88joYEaI47CnQkxO1XZdpoTF9fEnW2duIddhw=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.32.0/go.mod h1:6Am3rn7P9TVVeXYG+wtcGE7IE1tsQ+bP3AuWcKt/gOI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0 h1:wpMfgF8E1rkrT1Z6meFh1NDtownE9Ii3n3X2GJYjsaU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.33.0/go.mod h1:wAy0T/dUbs468uOlkT31xjvqQgEVXv58BRFWEgn5v/0=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.33.0 h1:W5AWUn/IVe8RFb5pZx1Uh9Laf/4+Qmm4kJL5zPuvR+0=
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.33.0/go.mod h1:mzKxJywMNBdEX8TSJais3NnsVZUaJ+bAy6UxPTng2vk=
go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ=
Expand Down Expand Up @@ -1180,8 +1180,8 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk=
google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY=
gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo=
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
Expand Down
18 changes: 9 additions & 9 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (

// allow the tests to capture output
var (
stdout io.Writer = os.Stdout
stderr io.Writer = os.Stderr
Stdout io.Writer = os.Stdout
Stderr io.Writer = os.Stderr
)

// The porter agent wraps the porter cli,
Expand Down Expand Up @@ -67,19 +67,19 @@ func Execute(porterCommand []string, porterHome string, porterConfig string) (er
}

// Remind everyone the version of Porter we are using
fmt.Fprintf(stderr, "porter version\n")
fmt.Fprintf(Stderr, "porter version\n")
cmd := exec.Command(porter, "version")
cmd.Stdout = stderr // send all non-bundle output to stderr
cmd.Stderr = stderr
cmd.Stdout = Stderr // send all non-bundle output to stderr
cmd.Stderr = Stderr
if err = cmd.Run(); err != nil {
return fmt.Errorf("porter version check failed: %w", err), false
}

// Run the specified porter command
fmt.Fprintf(stderr, "porter %s\n", strings.Join(porterCommand, " "))
fmt.Fprintf(Stderr, "porter %s\n", strings.Join(porterCommand, " "))
cmd = exec.Command(porter, porterCommand...)
cmd.Stdout = stdout
cmd.Stderr = stderr
cmd.Stdout = Stdout
cmd.Stderr = Stderr
cmd.Stdin = os.Stdin
if err := cmd.Start(); err != nil {
return err, false
Expand All @@ -89,7 +89,7 @@ func Execute(porterCommand []string, porterHome string, porterConfig string) (er

func copyConfig(relPath string, configFile string, fi os.FileInfo, porterHome string) error {
destFile := filepath.Join(porterHome, relPath)
fmt.Fprintln(stderr, "Loading configuration", relPath, "into", destFile)
fmt.Fprintln(Stderr, "Loading configuration", relPath, "into", destFile)
src, err := os.OpenFile(configFile, os.O_RDONLY, 0)
if err != nil {
return err
Expand Down
Loading

0 comments on commit 570d37e

Please sign in to comment.