Xuanwo commented on code in PR #2719:
URL: 
https://github.com/apache/incubator-opendal/pull/2719#discussion_r1275071189


##########
.github/workflows/service_test_etcd.yml:
##########
@@ -0,0 +1,322 @@
+# 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-cluster:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Configure Etcd Service
+        # ETCD will use ports: 23790,23791,23792,23800,23801,23802
+        run: |
+            docker network create -d bridge etcd-net

Review Comment:
   I suggest starting with a single node to verify our implementation before 
extending it to an etcd cluster.



##########
.github/workflows/service_test_etcd.yml:
##########
@@ -0,0 +1,322 @@
+# 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-cluster:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Configure Etcd Service
+        # ETCD will use ports: 23790,23791,23792,23800,23801,23802
+        run: |
+            docker network create -d bridge etcd-net
+            docker run -d \
+            -p 23790:2379 \
+            -p 23800:2380 \
+            --network etcd-net \
+            --name etcd1 \
+            -e ALLOW_NONE_AUTHENTICATION=yes \
+            -e ETCD_NAME=etcd1 \
+            -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd1:2380 \
+            -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \
+            -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
+            -e ETCD_ADVERTISE_CLIENT_URLS=http://etcd1:2379 \
+            -e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
+            -e 
ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
 \
+            -e ETCD_INITIAL_CLUSTER_STATE=new \
+            -e ETCD_MAX_REQUEST_BYTES=10485760 \
+            bitnami/etcd:latest
+            
+            docker run -d \
+            -p 23791:2379 \
+            -p 23801:2380 \
+            --network etcd-net \
+            --name etcd2 \
+            -e ALLOW_NONE_AUTHENTICATION=yes \
+            -e ETCD_NAME=etcd2 \
+            -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd2:2380 \
+            -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \
+            -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
+            -e ETCD_ADVERTISE_CLIENT_URLS=http://etcd2:2379 \
+            -e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
+            -e 
ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
 \
+            -e ETCD_INITIAL_CLUSTER_STATE=new \
+            -e ETCD_MAX_REQUEST_BYTES=10485760 \
+            bitnami/etcd:latest
+            
+            docker run -d \
+            -p 23792:2379 \
+            -p 23802:2380 \
+            --network etcd-net \
+            --name etcd3 \
+            -e ALLOW_NONE_AUTHENTICATION=yes \
+            -e ETCD_NAME=etcd3 \
+            -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd3:2380 \
+            -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \
+            -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
+            -e ETCD_ADVERTISE_CLIENT_URLS=http://etcd3:2379 \
+            -e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
+            -e 
ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
 \
+            -e ETCD_INITIAL_CLUSTER_STATE=new \
+            -e ETCD_MAX_REQUEST_BYTES=10485760 \
+            bitnami/etcd:latest
+      - 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:

Review Comment:
   TLS setup is complex, it's better to make sure the plain etcd works first.



##########
.github/workflows/service_test_etcd.yml:
##########
@@ -0,0 +1,322 @@
+# 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-cluster:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v3
+
+      - name: Configure Etcd Service
+        # ETCD will use ports: 23790,23791,23792,23800,23801,23802
+        run: |
+            docker network create -d bridge etcd-net
+            docker run -d \
+            -p 23790:2379 \
+            -p 23800:2380 \
+            --network etcd-net \
+            --name etcd1 \
+            -e ALLOW_NONE_AUTHENTICATION=yes \
+            -e ETCD_NAME=etcd1 \
+            -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd1:2380 \
+            -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \
+            -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
+            -e ETCD_ADVERTISE_CLIENT_URLS=http://etcd1:2379 \
+            -e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
+            -e 
ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
 \
+            -e ETCD_INITIAL_CLUSTER_STATE=new \
+            -e ETCD_MAX_REQUEST_BYTES=10485760 \
+            bitnami/etcd:latest
+            
+            docker run -d \
+            -p 23791:2379 \
+            -p 23801:2380 \
+            --network etcd-net \
+            --name etcd2 \
+            -e ALLOW_NONE_AUTHENTICATION=yes \
+            -e ETCD_NAME=etcd2 \
+            -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd2:2380 \
+            -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \
+            -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
+            -e ETCD_ADVERTISE_CLIENT_URLS=http://etcd2:2379 \
+            -e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
+            -e 
ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
 \
+            -e ETCD_INITIAL_CLUSTER_STATE=new \
+            -e ETCD_MAX_REQUEST_BYTES=10485760 \
+            bitnami/etcd:latest
+            
+            docker run -d \
+            -p 23792:2379 \
+            -p 23802:2380 \
+            --network etcd-net \
+            --name etcd3 \
+            -e ALLOW_NONE_AUTHENTICATION=yes \
+            -e ETCD_NAME=etcd3 \
+            -e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://etcd3:2380 \
+            -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \
+            -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \
+            -e ETCD_ADVERTISE_CLIENT_URLS=http://etcd3:2379 \
+            -e ETCD_INITIAL_CLUSTER_TOKEN=etcd-cluster \
+            -e 
ETCD_INITIAL_CLUSTER=etcd1=http://etcd1:2380,etcd2=http://etcd2:2380,etcd3=http://etcd3:2380
 \
+            -e ETCD_INITIAL_CLUSTER_STATE=new \
+            -e ETCD_MAX_REQUEST_BYTES=10485760 \
+            bitnami/etcd:latest
+      - 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: Configure Etcd Service With TLS
+          # ETCD will use ports: 23790,23791,23792,23800,23801,23802
+          run: |
+            # Install cfssl & cfssljson
+            mkdir ~/bin
+            curl -s -L -o ~/bin/cfssl 
https://pkg.cfssl.org/R1.2/cfssl_linux-amd64
+            curl -s -L -o ~/bin/cfssljson 
https://pkg.cfssl.org/R1.2/cfssljson_linux-amd64
+            chmod +x ~/bin/{cfssl,cfssljson}
+
+            # Create ca

Review Comment:
   It's better to place those file in `services/etcd/fixtures` like `webdav` so 
other developers can start test locally.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to