forked from opensearch-project/opensearch-go
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (130 loc) · 5.38 KB
/
Copy pathtest-integration.yml
File metadata and controls
134 lines (130 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Integration
on: [push, pull_request]
env:
GITHUB_ACTIONS: true
OPENSEARCH_VERSION: 3.6.0
OPENSEARCH_NODE_COUNT: 3
SECURE_INTEGRATION: true
CONTAINER_PROVIDER: docker
CONTAINER_RUNTIME: docker
jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with: { go-version-file: 'go.mod' }
- run: go version
- name: Increase system limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Launch OpenSearch cluster
run: |
make cluster.clean cluster.build cluster.start
if [ "${SECURE_INTEGRATION}" = "true" ]; then
CURL_URL="https://localhost:9200"
CURL_OPTS="-sfku admin:myStrongPassword123!"
else
CURL_URL="http://localhost:9200"
CURL_OPTS="-sf"
fi
echo "=====> Waiting for cluster to be ready (max 125s)..."
for attempt in $(seq 25); do
sleep 5
if curl ${CURL_OPTS} ${CURL_URL} > /dev/null 2>&1; then
echo "=====> Cluster ready after $((attempt * 5))s"
curl -s ${CURL_OPTS} ${CURL_URL} | jq -r '.version.number // "unknown"' | xargs echo "OpenSearch version:"
break
fi
if [ $attempt -eq 25 ]; then
echo "=====> ERROR: Cluster failed to start after 125s"
echo ""
echo "=====> Container status:"
docker compose --project-directory .ci/opensearch ps
echo ""
echo "=====> Node 1 logs (last 50 lines):"
docker compose --project-directory .ci/opensearch logs --tail=50 opensearch-node1
echo ""
echo "=====> Node 2 logs (last 50 lines):"
docker compose --project-directory .ci/opensearch logs --tail=50 opensearch-node2
echo ""
echo "=====> Node 3 logs (last 50 lines):"
docker compose --project-directory .ci/opensearch logs --tail=50 opensearch-node3
exit 1
fi
echo "=====> Attempt $attempt/25 - waiting..."
done
- run: make test-integ-core test-integ-plugins race=true coverage=true
- name: Merge coverage files
run: |
go tool covdata textfmt -i=tmp/integration-core,tmp/integration-plugins -o tmp/integ.cov
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tmp/integ.cov
flags: integration
secured:
name: Tests against secure cluster
runs-on: ubuntu-latest
env:
SECURE_INTEGRATION: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with: { go-version-file: 'go.mod' }
- run: go version
- name: Increase system limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Launch OpenSearch cluster
run: |
make cluster.clean cluster.build cluster.start
if [ "${SECURE_INTEGRATION}" = "true" ]; then
CURL_URL="https://localhost:9200"
CURL_OPTS="-sfku admin:myStrongPassword123!"
else
CURL_URL="http://localhost:9200"
CURL_OPTS="-sf"
fi
echo "=====> Waiting for cluster to be ready (max 125s)..."
for attempt in $(seq 25); do
sleep 5
if curl ${CURL_OPTS} ${CURL_URL} > /dev/null 2>&1; then
echo "=====> Cluster ready after $((attempt * 5))s"
curl -s ${CURL_OPTS} ${CURL_URL} | jq -r '.version.number // "unknown"' | xargs echo "OpenSearch version:"
break
fi
if [ $attempt -eq 25 ]; then
echo "=====> ERROR: Cluster failed to start after 125s"
echo ""
echo "=====> Container status:"
docker compose --project-directory .ci/opensearch ps
echo ""
echo "=====> Node 1 logs (last 50 lines):"
docker compose --project-directory .ci/opensearch logs --tail=50 opensearch-node1
echo ""
echo "=====> Node 2 logs (last 50 lines):"
docker compose --project-directory .ci/opensearch logs --tail=50 opensearch-node2
echo ""
echo "=====> Node 3 logs (last 50 lines):"
docker compose --project-directory .ci/opensearch logs --tail=50 opensearch-node3
exit 1
fi
echo "=====> Attempt $attempt/25 - waiting..."
done
- run: make cluster.get-cert test-integ-core test-integ-plugins race=true coverage=true
- name: Merge coverage files
run: |
go tool covdata textfmt -i=tmp/integration-core,tmp/integration-plugins -o tmp/integ.cov
- uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: tmp/integ.cov
flags: integration