Skip to content

Commit 1674b68

Browse files
committed
Run e2e tests as matrix for builder & deployer combintation
1 parent 1fa9662 commit 1674b68

3 files changed

Lines changed: 36 additions & 18 deletions

File tree

.github/workflows/test-e2e.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,13 @@ concurrency:
1111

1212
jobs:
1313
test-e2e:
14-
name: E2E Tests
14+
name: E2E Tests (${{ matrix.builder }}/${{ matrix.deployer }})
1515
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
builder: [pack, s2i]
20+
deployer: [knative, raw, keda]
1621
steps:
1722
- name: Clone the code
1823
uses: actions/checkout@v4
@@ -50,4 +55,6 @@ jobs:
5055
env:
5156
REGISTRY_INSECURE: true
5257
REGISTRY: kind-registry:5000
58+
DEFAULT_BUILDER: ${{ matrix.builder }}
59+
DEFAULT_DEPLOYER: ${{ matrix.deployer }}
5360
run: make test-e2e

test/e2e/func_middleware_update_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,9 @@ var _ = Describe("Middleware Update", func() {
7676
DeferCleanup(os.RemoveAll, repoDir)
7777

7878
// Deploy function using the same OLD func CLI version
79-
out, err := utils.RunFuncWithVersion(oldFuncVersion, "deploy",
80-
"--namespace", functionNamespace,
81-
"--path", repoDir,
82-
"--registry", utils.Registry(),
83-
fmt.Sprintf("--registry-insecure=%t", utils.IsRegistryInsecure()))
79+
out, err := utils.RunFuncDeploy(repoDir,
80+
utils.WithNamespace(functionNamespace),
81+
utils.WithDeployCliVersion(oldFuncVersion))
8482
Expect(err).NotTo(HaveOccurred())
8583
_, _ = fmt.Fprint(GinkgoWriter, out)
8684

test/utils/func.go

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,27 @@ func RunFunc(command string, args ...string) (string, error) {
3333
return Run(cmd)
3434
}
3535

36+
// RunFuncWithVersion executes the func CLI with a specific version
37+
// It downloads and caches the version if not already present
38+
func RunFuncWithVersion(version string, command string, args ...string) (string, error) {
39+
funcBinary, err := ensureFuncVersion(version)
40+
if err != nil {
41+
return "", err
42+
}
43+
44+
allArgs := append([]string{command}, args...)
45+
cmd := exec.Command(funcBinary, allArgs...)
46+
return Run(cmd)
47+
}
48+
3649
// RunFuncDeploy runs func deploy
3750
func RunFuncDeploy(functionDir string, optFns ...FuncDeployOption) (string, error) {
3851
opts := &FuncDeployOptions{
3952
// defaults
4053
Registry: Registry(),
4154
RegistryInsecure: IsRegistryInsecure(),
55+
Builder: os.Getenv("DEFAULT_BUILDER"),
56+
Deployer: os.Getenv("DEFAULT_DEPLOYER"),
4257
}
4358

4459
for _, optFn := range optFns {
@@ -63,20 +78,11 @@ func RunFuncDeploy(functionDir string, optFns ...FuncDeployOption) (string, erro
6378
args = append(args, "--deployer", opts.Deployer)
6479
}
6580

66-
return RunFunc("deploy", args...)
67-
}
68-
69-
// RunFuncWithVersion executes the func CLI with a specific version
70-
// It downloads and caches the version if not already present
71-
func RunFuncWithVersion(version string, command string, args ...string) (string, error) {
72-
funcBinary, err := ensureFuncVersion(version)
73-
if err != nil {
74-
return "", err
81+
if opts.CliVersion != "" {
82+
return RunFuncWithVersion(opts.CliVersion, "deploy", args...)
7583
}
7684

77-
allArgs := append([]string{command}, args...)
78-
cmd := exec.Command(funcBinary, allArgs...)
79-
return Run(cmd)
85+
return RunFunc("deploy", args...)
8086
}
8187

8288
type FuncDeployOptions struct {
@@ -85,6 +91,7 @@ type FuncDeployOptions struct {
8591
Namespace string
8692
Builder string
8793
Deployer string
94+
CliVersion string
8895
}
8996

9097
type FuncDeployOption func(*FuncDeployOptions)
@@ -107,6 +114,12 @@ func WithDeployer(deployer string) FuncDeployOption {
107114
}
108115
}
109116

117+
func WithDeployCliVersion(version string) FuncDeployOption {
118+
return func(opts *FuncDeployOptions) {
119+
opts.CliVersion = version
120+
}
121+
}
122+
110123
// ensureFuncVersion ensures the specified func version is available and returns its path
111124
func ensureFuncVersion(version string) (string, error) {
112125
projectDir, err := GetProjectDir()

0 commit comments

Comments
 (0)