Skip to content

Commit 3250267

Browse files
authored
chore(ci): manager systemd integration tests (#1724)
* chore(ci): manager integration tests * f * f * f * f
1 parent ccc7fcd commit 3250267

File tree

12 files changed

+171
-10
lines changed

12 files changed

+171
-10
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ jobs:
6262
int-tests:
6363
name: Integration tests
6464
runs-on: ubuntu-latest
65+
needs:
66+
- int-tests-kind
67+
- int-tests-manager
68+
steps:
69+
- name: Succeed if all tests passed
70+
run: echo "Integration tests succeeded"
71+
72+
int-tests-kind:
73+
name: Integration tests (kind)
74+
runs-on: ubuntu-latest
6575
steps:
6676
- name: Checkout
6777
uses: actions/checkout@v4
@@ -77,7 +87,22 @@ jobs:
7787
sudo mv ./kind /usr/local/bin/kind
7888
- name: Run tests
7989
run: |
80-
make -C tests/integration test
90+
make -C tests/integration test-kind
91+
92+
int-tests-manager:
93+
name: Integration tests (manager)
94+
runs-on: ubuntu-latest
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
- name: Setup go
99+
uses: actions/setup-go@v5
100+
with:
101+
go-version-file: go.mod
102+
cache-dependency-path: "**/*.sum"
103+
- name: Run tests
104+
run: |
105+
make -C tests/integration test-manager
81106
82107
dryrun-tests:
83108
name: Dryrun tests

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ preflightbundle*
2424

2525
hack/release.tgz
2626
hack/release
27+
28+
# Test binary, built with `go test -c`
29+
*.test

tests/integration/Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ PARALLEL ?= 2
55
RUN ?=
66

77
.PHONY: test
8-
test: test-openebs
8+
test: test-kind test-manager
99

10-
.PHONY: test-openebs
11-
test-openebs:
12-
DEBUG=$(DEBUG) go test -v -tags exclude_graphdriver_btrfs \
13-
-timeout=5m \
14-
-parallel=$(PARALLEL) \
15-
-run='$(value RUN)' \
16-
./openebs/...
10+
.PHONY: test-kind
11+
test-kind:
12+
$(MAKE) -C ./kind test
13+
14+
.PHONY: test-manager
15+
test-manager:
16+
$(MAKE) -C ./manager clean build test

tests/integration/kind/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
SHELL := /bin/bash
2+
3+
DEBUG ?=
4+
PARALLEL ?= 2
5+
RUN ?=
6+
7+
.PHONY: test
8+
test: test-openebs
9+
10+
.PHONY: test-openebs
11+
test-openebs:
12+
DEBUG=$(DEBUG) go test -v -tags exclude_graphdriver_btrfs \
13+
-timeout=5m \
14+
-parallel=$(PARALLEL) \
15+
-run='$(value RUN)' \
16+
./openebs/...

tests/integration/openebs/common.go renamed to tests/integration/kind/openebs/common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"testing"
55
"time"
66

7-
"github.com/replicatedhq/embedded-cluster/tests/integration/openebs/static"
7+
"github.com/replicatedhq/embedded-cluster/tests/integration/kind/openebs/static"
88
"github.com/replicatedhq/embedded-cluster/tests/integration/util"
99
)
1010

tests/integration/manager/Makefile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
SHELL := /bin/bash
2+
3+
DEBUG ?=
4+
RUN ?=
5+
6+
CONTAINER_NAME = integration-test-manager
7+
8+
.PHONY: test
9+
test: DISTRO = debian-bookworm
10+
test:
11+
@-docker rm -f $(CONTAINER_NAME) 2>/dev/null ; true
12+
@docker run -d \
13+
--name $(CONTAINER_NAME) \
14+
--privileged \
15+
--restart=unless-stopped \
16+
-v $(shell pwd)/manager.test:/wrk/manager.test \
17+
-v $(shell pwd)/../../../pkg/goods/bins/manager:/wrk/bin/manager \
18+
-e DATA_DIR=/wrk \
19+
replicated/ec-distro:$(DISTRO)
20+
@sleep 5 # wait for container to be ready
21+
docker exec \
22+
-e DEBUG=$(DEBUG) \
23+
$(CONTAINER_NAME) \
24+
/wrk/manager.test \
25+
-test.v \
26+
-test.timeout=5m \
27+
-test.run='$(value RUN)'
28+
29+
.PHONY: clean
30+
clean:
31+
rm -f manager.test
32+
-docker rm -f $(CONTAINER_NAME) 2>/dev/null ; true
33+
34+
.PHONY: build
35+
build: manager.test ../../../pkg/goods/bins/manager
36+
37+
manager.test:
38+
GOOS=linux go test -c .
39+
40+
../../../pkg/goods/bins/manager:
41+
$(MAKE) -C ../../../ pkg/goods/bins/manager

0 commit comments

Comments
 (0)