1,基礎環境
win 10
docker for desktop windows
wsl Ubuntu-22.04 鏡像,原來使用 20.04的時候,莫名其妙的出問題,換成22.04就好了。
2,wsl進入 linux
先安裝 go.
https://github.com/golang/go/wiki/Ubuntu
3,安裝 e2e
1)https://skywalking.apache.org/docs/skywalking-infra-e2e/next/en/setup/install/
go install github.com/apache/skywalking-infra-e2e/cmd/e2e@<revision>
2) 配置環境變量
在 /etc/profile 中增加永久環境變量 (https://www.cnblogs.com/yaoqingzhuan/p/10889718.html)
4,安裝
如果不安裝會顯示錯誤信息:
ERROR failed to execute the query: swctl --display yaml --base-url=http://127.0.0.1:${oap_12800}/graphql service ls, output: , error: bash: line 23: swctl: command not found
linux shell: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/apache/skywalking-cli/master/scripts/install.sh)"
https://github.com/apache/skywalking-cli/tree/0.11.0
5, https://github.com/apache/skywalking-infra-e2e clone下來測試一下吧。
效果如下:
F:\github\apache\skywalking-infra-e2e\examples\compose>wsl
root@DESKTOP-P1D7M3U:/mnt/f/github/apache/skywalking-infra-e2e/examples/compose# e2e run
INFO load the e2e config successfully
Container skywalking_e2e-oap-1 Created
Container skywalking_e2e-ui-1 Created
。。。。。。
這個項目到今天爲止,test 鏡像過期了, compose中的測試需要換一下鏡像再啓動。
10.常見問題。
1)ERROR commands: [# kind k8s cluster is in $TMPDIR\ncp $TMPDIR/e2e-k8s.config ~/.kube/config\nexport ISTIO_VERSION=1.9.1\nistioctl version || (curl -L https://istio.io/downloadIstio | sh - && sudo mv $PWD/istio-$ISTIO_VERSION/bin/istioctl /usr/local/bin/)\nistioctl install -y --set profile=demo \\n --set meshConfig.defaultConfig.envoyMetricsService.address=skywalking-oap.istio-system:11800 \\n --set values.telemetry.v2.enabled=false\nkubectl label namespace default istio-injection=enabled\n] runs error: cp: cannot create re
gular file '/root/.kube/config': No such file or dir
A: mkdir /root/.kube
11,莫名編譯不過,Windows 換行與 Linix/Mac 換行不同, CRLF問題引發。
可以在IDEA中進行單個修改,也可以選中整個目錄直接幹
2,或者在 WSL 執行 批量操作 find /path/to/directory -type f -print0 | xargs -0 dos2unix , 有一定的風險,要小心。
其中,/path/to/directory 是要處理的目錄路徑,-type f 選項表示要查找的是普通文件,而不是目錄或其他類型的文件,-print0 選項表示使用 null 字符作爲文件名之間的分隔符,以避免因爲文件名中包含空格或其他特殊字符而導致的錯誤。最後,通過管道將文件列表傳遞給 xargs 命令,使用 dos2unix 命令對每個文件進行處理。
這個命令會處理指定目錄下的所有文件,包括子目錄中的文件。如果想要對某些特定類型的文件進行處理,可以將 -name 選項添加到 find 命令中,指定要處理的文件擴展名,例如 -name "*.txt" 表示只處理擴展名爲 .txt 的文件。
如。
ERROR execute command error
ERROR execute steps error: commands: [bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq] runs error: bash: test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh: No such file or directory
對這個 sh文件全部處理。
/mnt/f/github/zbw911/skywalking-satellite/test# find . -type f -name "*.sh" -print0 | xargs -0 dos2unix
3,
root@DESKTOP-P1D7M3U:/mnt/f/github/zbw911/skywalking-satellite/test/e2e/case/native-protocols# e2e run
。。
ERROR execute command error
ERROR execute steps error: commands: [bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq] runs error: bash: test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh: No such file or directory
ERROR [Setup] commands: [bash test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh yq] runs error: bash: test/e2e/base/scripts/prepare/setup-e2e-shell/install.sh: No such file or directory
原因是運行路徑,有時可能要在項目的根目錄執行。如下就可以正常了,參考,(注意路關係)
root@DESKTOP-P1D7M3U:/mnt/f/github/zbw911/skywalking-satellite# e2e run -c test/e2e/case/native-protocols/e2e.yaml