Skip to content

Commit

Permalink
Fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzu committed Dec 19, 2024
1 parent e1ab787 commit d8ca41d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
incus:
image: ghcr.io/miscord-dev/incus-docker-debian:bookworm-slim-6.7-20241127
container_name: incus
privileged: true
environment:
- SETIPTABLES=true
restart: unless-stopped
network_mode: host
pid: host
cgroup: host
volumes:
- /dev:/dev
- /var/lib/incus:/var/lib/incus
- /lib/modules:/lib/modules:ro
5 changes: 4 additions & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/checkout@v4

- run: |
docker compose up -d
cd .github && docker compose up -d
docker ps -a
curl -LO https://github.com/lxc/incus/releases/latest/download/bin.linux.incus.x86_64
sudo install *incus* /usr/local/bin/incus
Expand All @@ -58,6 +58,7 @@ jobs:
"access_token": idToken,
"token": "bearer",
}))
require("fs").writeFileSync(homedir + "/.config/incus/oidctokens/incus.txt", idToken)
- run: |
mkdir -p ~/.config/incus/servercerts
Expand Down Expand Up @@ -94,6 +95,8 @@ jobs:

- name: Running Test e2e
run: |
export INCUS_CERT=~/.config/incus/servercerts/incus.crt
export INCUS_TOKEN=~/.config/incus/oidctokens/incus.txt
go mod tidy
make test-e2e
Expand Down
23 changes: 23 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ var _ = Describe("Manager", Ordered, func() {
_, err = utils.Run(cmd)
Expect(err).NotTo(HaveOccurred(), "Failed to install CRDs")

patch, _ := json.Marshal([]any{
map[string]any{
"op": "replace",
"path": "/spec/template/spec/containers/0/args",
"value": []string{
"--leader-elect",
"--health-probe-bind-address=:8081",
"--incus-url=https://localhost:8443",
"--incus-insecure-skip-tls-verify",
"--incus-tls-ca=" + os.Getenv("INCUS_CERT"),
"--incus-oidc-token-file=/tmp/incus-token" + os.Getenv("INCUS_TOKEN"),
},
},
})

cmd = exec.Command("kubectl", "patch", "deployment", "cluster-api-provider-incus-controller-manager",
"-n", namespace,
"--type=json",
"-p="+string(patch),
)
_, err = utils.Run(cmd)
Expect(err).NotTo(HaveOccurred(), "Failed to patch Deployment")

By("deploying the controller-manager")
cmd = exec.Command("make", "deploy", fmt.Sprintf("IMG=%s", projectImage))
_, err = utils.Run(cmd)
Expand Down

0 comments on commit d8ca41d

Please sign in to comment.