This is an automated email from the ASF dual-hosted git repository.
lujiajing pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-go.git
The following commit(s) were added to refs/heads/main by this push:
new c54f609 Support running e2e tests on MacOS (#56)
c54f609 is described below
commit c54f6092952c2c9e88acb30950cc8a755bbe63b3
Author: ethan256 <[email protected]>
AuthorDate: Thu Jun 8 18:22:58 2023 +0800
Support running e2e tests on MacOS (#56)
* fix custome file do not take effect
* add service_name assert
* add licenses
* support running e2e tests on MacOS
* add a new CI env of MacOS
* setup docker
* add macos test to plugin-tests
* use homebrew install docker
* fix macos run e2e test
* fix docker-compose command on macos
* install docker-compose on macos ci
* fix ci
* move sed command to replace function
* fix replace function
* add macos-test check on merge
---------
Co-authored-by: Jiajing LU <[email protected]>
Co-authored-by: mrproliu <[email protected]>
---
.github/workflows/plugin-tests.yaml | 67 +++++++++++++++++++++++++++++++++----
test/plugins/run.sh | 34 +++++++++++++++----
2 files changed, 88 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/plugin-tests.yaml
b/.github/workflows/plugin-tests.yaml
index 2d1fec5..204eea2 100644
--- a/.github/workflows/plugin-tests.yaml
+++ b/.github/workflows/plugin-tests.yaml
@@ -25,14 +25,27 @@ on:
jobs:
build:
- name: Build Plugin Test
- runs-on: ubuntu-latest
+ name: Build Plugin Test On ${{ matrix.os }}
+ strategy:
+ fail-fast: true
+ matrix:
+ os: [ubuntu, macos]
+ runs-on: ${{ matrix.os }}-latest
timeout-minutes: 60
steps:
- name: Set up Go 1.18
uses: actions/setup-go@v2
with:
go-version: 1.18
+ - name: Setup docker (missing on MacOS)
+ if: runner.os == 'macos'
+ run: |
+ brew install docker
+ colima start
+
+ # For testcontainers to find the Colima socket
+ #
https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
+ sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
@@ -42,7 +55,7 @@ jobs:
- uses: actions/upload-artifact@v2
name: Upload Test Base
with:
- name: test-tools
+ name: test-tools-${{ matrix.os }}
path: |
test/plugins/dist
@@ -71,7 +84,7 @@ jobs:
submodules: true
- uses: actions/download-artifact@v2
with:
- name: test-tools
+ name: test-tools-ubuntu
path: test/plugins/dist
- name: Setup Tools
run: |
@@ -86,18 +99,58 @@ jobs:
if: ${{ failure() }}
with:
path: test/plugins/workspace
- name: test-plugins-workspace-${{ matrix.case }}
+ name: test-plugins-workspace-${{ matrix.case }}-ubuntu
+
+ test-on-macos:
+ if: always()
+ name: gin-macos
+ needs:
+ - build
+ runs-on: macos-latest
+ timeout-minutes: 90
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+ - uses: actions/download-artifact@v2
+ with:
+ name: test-tools-macos
+ path: test/plugins/dist
+ - name: Setup docker (missing on MacOS)
+ if: runner.os == 'macos'
+ run: |
+ brew install docker docker-compose
+ colima start
+
+ # For testcontainers to find the Colima socket
+ #
https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running
+ sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
+ - name: Setup Tools
+ run: |
+ chmod +x test/plugins/dist/*
+ if ls test/plugins/dist/skywalking-agent-test-validator-1.0.0.tgz;
then
+ docker load -i
test/plugins/dist/skywalking-agent-test-validator-1.0.0.tgz
+ fi
+ - name: Run Test
+ run: bash test/plugins/run.sh gin
+ - uses: actions/upload-artifact@v2
+ name: Upload Agent
+ if: ${{ failure() }}
+ with:
+ path: test/plugins/workspace
+ name: test-plugins-workspace-gin-macos
required:
if: always()
name: Plugin Tests
needs:
- test
+ - test-on-macos
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Merge Requirement
run: |
- if [[ ${{ needs.test.result }} != 'success' ]]; then
+ if [[ ${{ needs.test.result }} != 'success' || ${{
needs.test-on-macos.result }} != 'success' ]]; then
exit -1
- fi
\ No newline at end of file
+ fi
diff --git a/test/plugins/run.sh b/test/plugins/run.sh
index b4173c9..dfb4114 100755
--- a/test/plugins/run.sh
+++ b/test/plugins/run.sh
@@ -28,6 +28,29 @@ num_of_testcases=0
start_stamp=`date +%s`
+replace() {
+ if [ $# -lt 2 ]; then
+ echo 1
+ return
+ fi
+
+ opt=''
+ cmd=$1
+ file=$2
+ if [ $# -eq 3 ]; then
+ opt=$1
+ cmd=$2
+ file=$3
+ fi
+
+ if [ $(uname) = 'Darwin' ]; then
+ sed -i '' $opt "$cmd" "$file"
+ else
+ sed -i $opt "$cmd" "$file"
+ fi
+}
+export -f replace
+
print_help() {
echo "Usage: run.sh [OPTION] SCENARIO_NAME"
echo -e "\t--clean, \t\t\t remove the related images and directories"
@@ -155,16 +178,15 @@ for framework_version in $frameworks; do
cp -rf ${scenario_home}/* ${case_home}
cd ${case_home}
- # replace go version
- sed -i "s/^go [0-9]*\.[0-9]*/go ${go_version}/" go.mod
# append the module name(for go1.20, module name cannot be same in same
workspace)
mod_case_name=$(echo "${case_name}" | sed 's/\//_/g; s/\./_/g; s/-/_/g')
mod_name=$(head -n 1 go.mod | cut -d " " -f 2)
- sed -i "s/^module /module ${mod_case_name}\//" go.mod
- find . -name "*.go" -type f -exec sed -i
"s|${mod_name}|${mod_case_name}/${mod_name}|g" {} \;
-
+ # replace go version
+ replace "s/^go [0-9]*\.[0-9]*/go ${go_version}/" go.mod
+ replace "s/^module /module ${mod_case_name}\//" go.mod
+ find . -name "*.go" -type f -exec bash -c "replace
\"s|${mod_name}|${mod_case_name}/${mod_name}|g\" \"{}\"" \;
# ajust the plugin replace path
- sed -i -E '/^replace/ s#(\.\./)#\1../#' go.mod
+ replace -E '/^replace/ s#(\.\./)#\1../#' go.mod
# replace framework version
if [[ "$framework_version" != "native" ]]; then