-
Notifications
You must be signed in to change notification settings - Fork 481
215 lines (200 loc) · 8.25 KB
/
service_test_etcd.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: Service Test Etcd
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- "core/src/**"
- "core/tests/**"
- "!core/src/docs/**"
- "!core/src/services/**"
- "core/src/services/etcd/**"
- ".github/workflows/service_test_etcd.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
etcd:
runs-on: ubuntu-latest
services:
etcd:
image: bitnami/etcd:latest
ports:
- "2379:2379"
- "2380:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd:2379
ETCD_MAX_REQUEST_BYTES: 10485760
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-protoc: true
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run etcd --features services-etcd
env:
OPENDAL_ETCD_TEST: on
OPENDAL_ETCD_ENDPOINTS: http://127.0.0.1:2379
OPENDAL_ETCD_ROOT: /tmp/opendal
etcd-cluster:
runs-on: ubuntu-latest
services:
etcd1:
image: bitnami/etcd:latest
ports:
- "23790:2379"
- "23800:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd1
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd1:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd1:2379
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_MAX_REQUEST_BYTES: 10485760
etcd2:
image: bitnami/etcd:latest
ports:
- "23791:2379"
- "23801:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd2
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd2:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd2:2379
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_MAX_REQUEST_BYTES: 10485760
etcd3:
image: bitnami/etcd:latest
ports:
- "23792:2379"
- "23802:2380"
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_NAME: etcd3
ETCD_INITIAL_ADVERTISE_PEER_URLS: http://etcd3:2380
ETCD_LISTEN_PEER_URLS: http://0.0.0.0:2380
ETCD_LISTEN_CLIENT_URLS: http://0.0.0.0:2379
ETCD_ADVERTISE_CLIENT_URLS: http://etcd3:2379
ETCD_INITIAL_CLUSTER_TOKEN: etcd-cluster
ETCD_INITIAL_CLUSTER: etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
ETCD_INITIAL_CLUSTER_STATE: new
ETCD_MAX_REQUEST_BYTES: 10485760
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-protoc: true
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run etcd --features services-etcd
env:
OPENDAL_ETCD_TEST: on
OPENDAL_ETCD_ENDPOINTS: http://127.0.0.1:23790,http://127.0.0.1:23791,http://127.0.0.1:23792
OPENDAL_ETCD_ROOT: /tmp/opendal
etcd-cluster-tls:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Copy Etcd Certificate Files
shell: bash
working-directory: core
run: |
mkdir -p /tmp/etcd
cp -r `pwd`/src/services/etcd/fixtures/* /tmp/etcd
- name: Configure Etcd Service With TLS
# ETCD will use ports: 23790,23791,23792,23800,23801,23802
run: |
# Create docker network
docker network create -d bridge --subnet=176.16.12.0/24 --gateway=176.16.12.1 etcd-tls-net
# Launch etcd
for no in `seq 0 2`; do \
num=$((no+1))
ip=$((no+2))
docker run -d \
-p 2379${no}:2379 \
-p 2380${no}:2380 \
--network etcd-tls-net \
--name etcd-tls-${num} \
--ip 176.16.12.${ip} \
-v /tmp/etcd/ca.pem:/opt/bitnami/etcd/conf/ca.pem \
-v /tmp/etcd/server.pem:/opt/bitnami/etcd/conf/server.pem \
-v /tmp/etcd/server-key.pem:/opt/bitnami/etcd/conf/server-key.pem \
-v /tmp/etcd/client-key.pem:/opt/bitnami/etcd/client-key.pem \
-v /tmp/etcd/client.pem:/opt/bitnami/etcd/client.pem \
-v /tmp/etcd/etcd${num}/etcd.pem:/opt/bitnami/etcd/conf/peer.pem \
-v /tmp/etcd/etcd${num}/etcd-key.pem:/opt/bitnami/etcd/conf/peer-key.pem \
-e ETCD_ROOT_PASSWORD=opendal \
-e ETCD_CLIENT_CERT_AUTH=true \
-e ETCD_PEER_CLIENT_CERT_AUTH=true \
-e ETCD_NAME=etcd${num} \
-e ETCD_INITIAL_ADVERTISE_PEER_URLS=https://176.16.12.${ip}:2380 \
-e ETCD_LISTEN_PEER_URLS=https://0.0.0.0:2380 \
-e ETCD_LISTEN_CLIENT_URLS=https://0.0.0.0:2379 \
-e ETCD_ADVERTISE_CLIENT_URLS=https://176.16.12.${ip}:2379 \
-e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
-e ETCD_INITIAL_CLUSTER=etcd1=https://176.16.12.2:2380,etcd2=https://176.16.12.3:2380,etcd3=https://176.16.12.4:2380 \
-e ETCD_INITIAL_CLUSTER_STATE=new \
-e ETCD_MAX_REQUEST_BYTES=10485760 \
-e ETCD_TRUSTED_CA_FILE=/opt/bitnami/etcd/conf/ca.pem \
-e ETCD_KEY_FILE=/opt/bitnami/etcd/conf/server-key.pem \
-e ETCD_CERT_FILE=/opt/bitnami/etcd/conf/server.pem \
-e ETCD_PEER_TRUSTED_CA_FILE=/opt/bitnami/etcd/conf/ca.pem \
-e ETCD_PEER_KEY_FILE=/opt/bitnami/etcd/conf/peer-key.pem \
-e ETCD_PEER_CERT_FILE=/opt/bitnami/etcd/conf/peer.pem \
bitnami/etcd:latest
done
- name: Setup Rust toolchain
uses: ./.github/actions/setup
with:
need-protoc: true
need-nextest: true
- name: Test
shell: bash
working-directory: core
run: cargo nextest run etcd --features services-etcd
env:
OPENDAL_ETCD_TEST: on
OPENDAL_ETCD_ENDPOINTS: https://127.0.0.1:23790,https://127.0.0.1:23791,https://127.0.0.1:23792
OPENDAL_ETCD_ROOT: /tmp/opendal
OPENDAL_ETCD_USERNAME: root
OPENDAL_ETCD_PASSWORD: opendal
OPENDAL_ETCD_CA_PATH: /tmp/etcd/ca.pem
OPENDAL_ETCD_CERT_PATH: /tmp/etcd/client.pem
OPENDAL_ETCD_KEY_PATH: /tmp/etcd/client-key.pem