-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(node): basic playbook and coverage strategy
- Loading branch information
Showing
7 changed files
with
161 additions
and
0 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,43 @@ | ||
FROM golang:1.23-bookworm as BUILDER | ||
|
||
WORKDIR /app | ||
|
||
ADD . . | ||
|
||
RUN go build -cover -o ./bin/algorun *.go | ||
|
||
|
||
FROM fedora:39 as legacy | ||
|
||
ADD playbook.yaml /root/playbook.yaml | ||
COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun | ||
RUN dnf install systemd ansible-core -y && \ | ||
mkdir -p /app/coverage/int/fedora/39 && \ | ||
echo GOCOVERDIR=/app/coverage/int/fedora/39 >> /etc/environment | ||
|
||
STOPSIGNAL SIGRTMIN+3 | ||
CMD ["/usr/lib/systemd/systemd"] | ||
|
||
FROM fedora:40 as previous | ||
|
||
ADD playbook.yaml /root/playbook.yaml | ||
COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun | ||
|
||
RUN dnf install systemd ansible-core -y && \ | ||
mkdir -p /app/coverage/int/fedora/40 && \ | ||
echo GOCOVERDIR=/app/coverage/int/fedora/40 >> /etc/environment | ||
|
||
STOPSIGNAL SIGRTMIN+3 | ||
CMD ["/usr/lib/systemd/systemd"] | ||
|
||
FROM fedora:41 as latest | ||
|
||
ADD playbook.yaml /root/playbook.yaml | ||
COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun | ||
|
||
RUN dnf install systemd ansible-core -y && \ | ||
mkdir -p /app/coverage/int/fedora/41 && \ | ||
echo GOCOVERDIR=/app/coverage/int/fedora/41 >> /etc/environment | ||
|
||
STOPSIGNAL SIGRTMIN+3 | ||
CMD ["/usr/lib/systemd/systemd"] |
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,34 @@ | ||
FROM golang:1.23-bookworm as BUILDER | ||
|
||
WORKDIR /app | ||
|
||
ADD . . | ||
|
||
RUN go build -cover -o ./bin/algorun *.go | ||
|
||
|
||
FROM ubuntu:22.04 as jammy | ||
|
||
RUN apt-get update && apt-get install systemd software-properties-common -y && add-apt-repository --yes --update ppa:ansible/ansible | ||
|
||
ADD playbook.yaml /root/playbook.yaml | ||
COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun | ||
RUN mkdir -p /app/coverage/int/ubuntu/22.04 && \ | ||
echo GOCOVERDIR=/app/coverage/int/ubuntu/22.04 >> /etc/environment && \ | ||
apt-get install ansible -y | ||
|
||
STOPSIGNAL SIGRTMIN+3 | ||
CMD ["/usr/lib/systemd/systemd"] | ||
|
||
FROM ubuntu:24.04 as noble | ||
|
||
RUN apt-get update && apt-get install systemd software-properties-common -y && add-apt-repository --yes --update ppa:ansible/ansible | ||
|
||
ADD playbook.yaml /root/playbook.yaml | ||
COPY --from=BUILDER /app/bin/algorun /usr/bin/algorun | ||
RUN mkdir -p /app/coverage/int/ubuntu/24.04 && \ | ||
echo GOCOVERDIR=/app/coverage/int/ubuntu/24.04 >> /etc/environment && \ | ||
apt-get install ansible -y | ||
|
||
STOPSIGNAL SIGRTMIN+3 | ||
CMD ["/usr/lib/systemd/systemd"] |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
coverage | ||
hack-tui | ||
bin | ||
.data | ||
|
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,49 @@ | ||
services: | ||
ubuntu.22.04: | ||
privileged: true | ||
environment: | ||
- GOCOVERDIR=/app/coverage/int/ubuntu/22.04 | ||
build: | ||
context: . | ||
target: jammy | ||
dockerfile: .docker/Ubuntu.dockerfile | ||
ports: | ||
- "2222:22" | ||
volumes: | ||
- "./coverage/int/ubuntu/22.04:/app/coverage/int/ubuntu/22.04" | ||
ubuntu.24.04: | ||
privileged: true | ||
environment: | ||
- GOCOVERDIR=/app/coverage/int/ubuntu/24.04 | ||
build: | ||
context: . | ||
target: noble | ||
dockerfile: .docker/Ubuntu.dockerfile | ||
ports: | ||
- "2223:22" | ||
volumes: | ||
- "./coverage/int/ubuntu/24.04:/app/coverage/int/ubuntu/24.04" | ||
fedora.39: | ||
privileged: true | ||
environment: | ||
- GOCOVERDIR=/app/coverage/int/fedora/39 | ||
build: | ||
context: . | ||
target: legacy | ||
dockerfile: .docker/Fedora.dockerfile | ||
ports: | ||
- "2224:22" | ||
volumes: | ||
- "./coverage/int/fedora/39:/app/coverage/int/fedora/39" | ||
fedora.40: | ||
privileged: true | ||
environment: | ||
- GOCOVERDIR=/app/coverage/int/fedora/40 | ||
build: | ||
context: . | ||
target: previous | ||
dockerfile: .docker/Fedora.dockerfile | ||
ports: | ||
- "2225:22" | ||
volumes: | ||
- "./coverage/int/fedora/40:/app/coverage/int/fedora/40" |
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,21 @@ | ||
- name: Test Instance | ||
hosts: localhost | ||
tasks: | ||
- name: Ensure algorun exists | ||
stat: | ||
path: /usr/bin/algorun | ||
register: binpath | ||
- name: Fail missing binary | ||
fail: | ||
msg: "Must have algorun installed!" | ||
when: not binpath.stat.exists | ||
- name: Run installer | ||
command: algorun node install | ||
- name: Run installer twice | ||
command: algorun node install | ||
- name: Run upgrade | ||
command: algorun node upgrade | ||
- name: Run stop | ||
command: algorun node stop | ||
- name: Run Start | ||
command: algorun node start |
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,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose -f docker-compose.integration.yaml build --no-cache | ||
docker compose -f docker-compose.integration.yaml up -d | ||
|
||
for testInstance in $(docker compose ps --services) | ||
do | ||
docker compose exec -it "$testInstance" ansible-playbook --connection=local -i localhost /root/playbook.yaml | ||
done |