Skip to content

Commit 4725acc

Browse files
Merge pull request #309 from aleksei-burlakov/test-leap16.0
Test: add leap16.0 hawk-node
2 parents 460f837 + 9df4c04 commit 4725acc

5 files changed

Lines changed: 210 additions & 10 deletions

File tree

File renamed without changes.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM docker.io/opensuse/leap:16.0
2+
3+
# install deps (hawk2 will pull all the gems, but uglifier)
4+
# libglue-devel is for stonith:external/ssh params hostlist
5+
RUN zypper -n refresh \
6+
&& zypper -n install --no-recommends \
7+
systemd openssh-server \
8+
make gcc pam-devel hawk2 nodejs git \
9+
&& zypper -n clean -a
10+
11+
# allow root password login (specifically for the tests)
12+
RUN sed -i \
13+
-e 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' \
14+
-e 's/^#\?PasswordAuthentication .*/PasswordAuthentication yes/' \
15+
/usr/etc/ssh/sshd_config
16+
17+
RUN ssh-keygen -t rsa -N "" -f /root/.ssh/id_rsa \
18+
&& cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
19+
20+
# unlock root and set password to "linux"
21+
RUN passwd -u root || true && echo -e "linux\nlinux" | passwd root
22+
23+
# start sshd under systemd (`crm cluster init` will start it later anyway)
24+
RUN systemctl enable sshd
25+
26+
# backup the Gemfiles
27+
RUN cp /usr/share/hawk/Gemfile* /
28+
29+
# no need for the hawk itself, it should be copied in the git workflow
30+
RUN rm -rf /usr/share/hawk /etc/sysconfig/hawk
31+
32+
COPY *.patch /
33+
34+
ENV GEM_HOME=/usr/libexec/hawk/vendor/
35+
36+
CMD ["/usr/lib/systemd/systemd", "--system"]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/hawk/config/application.rb b/hawk/config/application.rb
2+
--- a/hawk/config/application.rb
3+
+++ b/hawk/config/application.rb
4+
@@ -44,6 +44,11 @@ module Hawk
5+
config.middleware.use Rack::Deflater
6+
end
7+
8+
+ JsRoutes.setup do |config|
9+
+ config.module_type = nil
10+
+ config.namespace = "Routes"
11+
+ end
12+
+
13+
config.x.hawk_is_sles = system("cat /etc/os-release | grep 'ID=.*sles' >/dev/null 2>&1")
14+
15+
def lookup_daemon_dir
16+
diff --git a/hawk/config/boot.rb b/hawk/config/boot.rb
17+
--- a/hawk/config/boot.rb
18+
+++ b/hawk/config/boot.rb
19+
@@ -38,7 +38,7 @@ else
20+
gem "virtus", version: "~> 1.0"
21+
require "virtus"
22+
23+
- gem "js-routes", version: ">= 1.3.3"
24+
+ gem "js-routes", version: ">= 2.0.0"
25+
require "js-routes"
26+
27+
gem "fast_gettext", version: "~> 1.4"
28+
diff --git a/hawk/config/environments/development.rb b/hawk/config/environments/development.rb
29+
--- a/hawk/config/environments/development.rb
30+
+++ b/hawk/config/environments/development.rb
31+
@@ -27,7 +27,7 @@ Rails.application.configure do
32+
33+
config.cache_store = :memory_store
34+
35+
- config.assets.debug = true
36+
+ config.assets.debug = false
37+
config.assets.raise_runtime_errors = true
38+
config.assets.js_compressor = nil
39+
config.assets.css_compressor = nil
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/scripts/hawk-backend.service.in b/scripts/hawk-backend.service.in
2+
index aafcadb7..143d6f66 100644
3+
--- a/scripts/hawk-backend.service.in
4+
+++ b/scripts/hawk-backend.service.in
5+
@@ -8,12 +8,11 @@ Type=simple
6+
KillMode=control-group
7+
TimeoutSec=300
8+
TimeoutStopSec=10
9+
-User=hacluster
10+
-Group=haclient
11+
WorkingDirectory=@WWW_BASE@/hawk
12+
Environment="HAWK_ENV=production"
13+
+Environment="GEM_HOME=/usr/libexec/hawk/vendor/"
14+
Environment="HAWK_BIND=unix://@WWW_BASE@/hawk/tmp/hawk.sock"
15+
EnvironmentFile=-/etc/sysconfig/hawk
16+
-ExecStart=/usr/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb
17+
-ExecStop=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop
18+
-ExecReload=/usr/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart
19+
+ExecStart=/usr/libexec/hawk/vendor/bin/puma@RUBY_SUFFIX@ -C @WWW_BASE@/hawk/config/puma.rb
20+
+ExecStop=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state stop
21+
+ExecReload=/usr/libexec/hawk/vendor/bin/pumactl@RUBY_SUFFIX@ -S @WWW_BASE@/hawk/tmp/pids/puma.state restart

.github/workflows/test-hawk.yaml

Lines changed: 114 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: e2e_test for hawk
1+
name: e2e_test for hawk on leap15.6 and leap16.0
22
on:
33
push:
44
branches:
@@ -12,47 +12,151 @@ env:
1212
IP_NODE2: 172.17.0.3
1313

1414
jobs:
15-
functional_test_hawk:
15+
build_examiner:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Check out repository code
19-
uses: actions/checkout@v2
20-
- name: Build hawk-node image
21-
run: |
22-
docker build -t hawk-node -f .github/docker/hawk-node.Dockerfile .
18+
- uses: actions/checkout@v4
2319
- name: Build hawk-examiner image
2420
run: |
2521
docker build -t hawk-examiner -f e2e_test/Dockerfile e2e_test
22+
23+
- name: Export hawk-examiner image
24+
run: |
25+
docker save hawk-examiner:latest -o hawk-examiner.tar
26+
27+
- name: Upload hawk-examiner image artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: hawk-examiner-image
31+
path: hawk-examiner.tar
32+
33+
test_leap156:
34+
runs-on: ubuntu-latest
35+
needs: build_examiner
36+
steps:
37+
- name: Check out repository code
38+
uses: actions/checkout@v4
39+
40+
- name: Download hawk-examiner image artifact
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: hawk-examiner-image
44+
45+
- name: Load hawk-examiner image
46+
run: |
47+
docker load -i hawk-examiner.tar
48+
49+
- name: Build hawk-node leap-15.6 image
50+
run: |
51+
docker build -t hawk-node -f .github/docker/hawk-node.leap156/Dockerfile .github/docker/hawk-node.leap156/
52+
2653
- name: Start cluster nodes in containers
2754
run: |
2855
docker run -d --privileged -h node1 --name node1 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node
2956
docker run -d --privileged -h node2 --name node2 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node
57+
3058
- name: Copy hawk to the nodes
3159
run: |
3260
docker cp "$GITHUB_WORKSPACE" node1:/
3361
docker cp "$GITHUB_WORKSPACE" node2:/
62+
3463
- name: Compile hawk in the nodes
3564
run: |
3665
docker exec -i node1 bash -c "cd hawk && make"
3766
docker exec -i node2 bash -c "cd hawk && make"
67+
3868
- name: Install hawk in the nodes
3969
run: |
4070
docker exec -i node1 bash -c "cd hawk && make install && cp scripts/sysconfig.hawk /etc/sysconfig/hawk"
4171
docker exec -i node2 bash -c "cd hawk && make install && cp scripts/sysconfig.hawk /etc/sysconfig/hawk"
72+
4273
- name: Workaround to run hawk as root (ok for tests)
4374
run: |
4475
docker exec node1 sed -i '/^User=/d' /usr/lib/systemd/system/hawk-backend.service
4576
docker exec node1 sed -i '/^Group=/d' /usr/lib/systemd/system/hawk-backend.service
4677
docker exec node2 sed -i '/^User=/d' /usr/lib/systemd/system/hawk-backend.service
4778
docker exec node2 sed -i '/^Group=/d' /usr/lib/systemd/system/hawk-backend.service
79+
4880
- name: Initialize container on the node1
49-
run: docker exec node1 crm cluster init -u -n cluster1 -y
81+
run: |
82+
docker exec node1 crm cluster init -u -n cluster1 -y
83+
5084
- name: Join node2 to the cluster
51-
run: docker exec node2 crm cluster join -c node1 -y
85+
run: |
86+
docker exec node2 crm cluster join -c node1 -y
87+
5288
- name: Create a stonith-sbd device
5389
run: |
5490
docker exec node1 crm configure primitive stonith-sbd stonith:external/ssh params hostlist="node1 node2"
5591
docker exec node1 crm conf property stonith-enabled=true
5692
docker exec node1 crm conf property have-watchdog=true
93+
94+
- name: Run the functional test
95+
run: |
96+
docker run --rm hawk-examiner -H ${IP_NODE1} -S ${IP_NODE2} -s linux --xvfb
97+
98+
- name: Cleanup
99+
if: always()
100+
run: |
101+
docker rm -f node1 node2 || true
102+
103+
test_leap160:
104+
runs-on: ubuntu-latest
105+
needs: build_examiner
106+
steps:
107+
- name: Check out repository code
108+
uses: actions/checkout@v4
109+
110+
- name: Download hawk-examiner image artifact
111+
uses: actions/download-artifact@v4
112+
with:
113+
name: hawk-examiner-image
114+
115+
- name: Load hawk-examiner image
116+
run: |
117+
docker load -i hawk-examiner.tar
118+
119+
- name: Build hawk-node leap-16.0 image
120+
run: |
121+
docker build -t hawk-node -f .github/docker/hawk-node.leap160/Dockerfile .github/docker/hawk-node.leap160/
122+
123+
- name: Start cluster nodes in containers
124+
run: |
125+
docker run -d --privileged -h node1 --name node1 --add-host node1:${IP_NODE1} --add-host node2:${IP_NODE2} hawk-node
126+
127+
- name: Copy hawk to the nodes
128+
run: |
129+
docker cp "$GITHUB_WORKSPACE" node1:/
130+
131+
- name: Apply patches and replace Gemfiles
132+
run: |
133+
docker exec -i node1 bash -c "cd hawk && git apply ../*.patch && cp /Gemfile* hawk"
134+
135+
- name: Compile hawk in the nodes
136+
run: |
137+
docker exec -i node1 bash -c "cd hawk && make"
138+
139+
- name: Install hawk in the nodes
140+
run: |
141+
docker exec -i node1 bash -c "cd hawk && make install && cp scripts/sysconfig.hawk /etc/sysconfig/hawk"
142+
143+
- name: Initialize container on the node1
144+
run: |
145+
docker exec node1 crm cluster init -n cluster2 -y
146+
147+
- name: Check status of hawk
148+
run: |
149+
docker exec node1 systemctl status hawk hawk-backend
150+
151+
- name: Create a stonith-sbd device
152+
run: |
153+
docker exec node1 crm configure primitive stonith-sbd ocf:pacemaker:Dummy
154+
57155
- name: Run the functional test
58-
run: docker run hawk-examiner -H ${IP_NODE1} -S ${IP_NODE2} -s linux --xvfb
156+
run: |
157+
docker run --rm hawk-examiner -H ${IP_NODE1} -s linux --xvfb
158+
159+
- name: Cleanup
160+
if: always()
161+
run: |
162+
docker rm -f node1 || true

0 commit comments

Comments
 (0)