-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
- Loading branch information
1 parent
5e6d057
commit ac5bf59
Showing
9 changed files
with
185 additions
and
104 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,41 @@ | ||
name: e2e | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'release/**' | ||
|
||
permissions: | ||
contents: read # for actions/checkout to fetch code | ||
|
||
jobs: | ||
kind: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
- name: Setup Go | ||
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache-dependency-path: | | ||
**/go.sum | ||
**/go.mod | ||
- name: Setup Kubernetes | ||
uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0 | ||
with: | ||
version: v0.23.0 | ||
cluster_name: kind | ||
- name: Run controller tests | ||
run: make test | ||
- name: Check if working tree is dirty | ||
run: | | ||
if [[ $(git diff --stat) != '' ]]; then | ||
git --no-pager diff | ||
echo 'run make test and commit changes' | ||
exit 1 | ||
fi | ||
- name: Run controller e2e tests | ||
run: make test-e2e |
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
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
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,47 @@ | ||
// Copyright 2024 Stefan Prodan. | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
|
||
package e2e | ||
|
||
import ( | ||
"os/exec" | ||
"time" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/controlplaneio-fluxcd/fluxcd-operator/test/utils" | ||
) | ||
|
||
var _ = Describe("FluxInstance", Ordered, func() { | ||
Context("installation", func() { | ||
It("should run successfully", func() { | ||
By("reconcile FluxInstance") | ||
verifyFluxInstanceReconcile := func() error { | ||
cmd := exec.Command("kubectl", "apply", | ||
"-k", "config/samples", "-n", namespace, | ||
) | ||
_, err := utils.Run(cmd) | ||
ExpectWithOffset(2, err).NotTo(HaveOccurred()) | ||
|
||
cmd = exec.Command("kubectl", "wait", "FluxInstance/flux", "-n", namespace, | ||
"--for=condition=Ready", "--timeout=10s", | ||
) | ||
_, err = utils.Run(cmd) | ||
ExpectWithOffset(2, err).NotTo(HaveOccurred()) | ||
return nil | ||
} | ||
EventuallyWithOffset(1, verifyFluxInstanceReconcile, time.Minute, 3*time.Second).Should(Succeed()) | ||
}) | ||
}) | ||
|
||
Context("uninstallation", func() { | ||
It("should run successfully", func() { | ||
By("delete FluxInstance") | ||
cmd := exec.Command("kubectl", "delete", "-k", "config/samples", | ||
"--timeout=30s", "-n", namespace) | ||
_, err := utils.Run(cmd) | ||
Expect(err).NotTo(HaveOccurred()) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.