-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
122 additions
and
3 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,39 @@ | ||
name: PR check - CLI Installation test | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
cli-test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: ./go.mod | ||
- name: Install kind | ||
uses: helm/[email protected] | ||
with: | ||
install_only: true | ||
- name: Run build | ||
run: make build | ||
- name: Build docker images | ||
run: make docker-build | ||
- name: Run installation test using CLI | ||
run: ./tests/cli/basic_test.sh | ||
- name: upload e2e k8s test logs | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: tests-cli | ||
path: /tmp/clusterlink-cli |
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
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,80 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) The ClusterLink Authors. | ||
# Licensed 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. | ||
|
||
set -ex | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
TEST_DIR=$(mktemp -d) | ||
CLI=$SCRIPT_DIR/../../bin/clusterlink | ||
|
||
function clean_up { | ||
kind delete cluster --name peer1 | ||
|
||
cd - | ||
} | ||
|
||
function clean_up_with_logs { | ||
# export logs | ||
kind export logs /tmp/clusterlink-cli --name peer1 | ||
|
||
clean_up | ||
} | ||
|
||
function test_k8s { | ||
# create fabric with a single peer (peer1) | ||
$CLI create fabric | ||
$CLI create peer-cert --name peer1 | ||
|
||
# create kind cluster | ||
kind create cluster --name peer1 | ||
|
||
# load images to cluster | ||
kind load docker-image cl-controlplane --name peer1 | ||
kind load docker-image cl-dataplane --name peer1 | ||
kind load docker-image cl-operator --name peer1 | ||
|
||
# configure kubectl | ||
kubectl config use-context kind-peer1 | ||
|
||
# wait for service account to be created | ||
timeout 30 sh -c 'until kubectl -n default get serviceaccount default -o name; do sleep 0.1; done > /dev/null 2>&1' | ||
|
||
# create clusterlink objects | ||
$CLI deploy peer --name peer1 --container-registry=docker.io/library --ingress=NodePort --ingress-port=30443 | ||
|
||
# wait for cl-controlplane and cl-dataplane to be created | ||
if ! timeout 30 sh -c 'until kubectl rollout status deployment cl-controlplane -n clusterlink-system; do sleep 0.1; done > /dev/null 2>&1'; then | ||
echo "Error: Timeout occurred while waiting for cl-controlplane deployment" | ||
exit 1 | ||
fi | ||
|
||
if ! timeout 30 sh -c 'until kubectl rollout status deployment cl-dataplane -n clusterlink-system; do sleep 0.1; done > /dev/null 2>&1'; then | ||
echo "Error: Timeout occurred while waiting for cl-dataplane deployment" | ||
exit 1 | ||
fi | ||
|
||
# Delete clusterlink objects | ||
$CLI delete peer --name peer1 | ||
|
||
} | ||
|
||
cd $TEST_DIR | ||
clean_up | ||
|
||
trap clean_up_with_logs INT TERM EXIT | ||
|
||
cd $TEST_DIR | ||
test_k8s | ||
|
||
echo OK |