skywalking e2e wsl 速搭

1,基础环境

win 10

docker for desktop windows 

wsl  Ubuntu-22.04  镜像,原来使用 20.04的时候,莫名其妙的出问题,换成22.04就好了。

image


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 

。。。。。。

image

   这个项目到今天为止,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 in
stall -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中进行单个修改,也可以选中整个目录直接干

image

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

posted @ 2023-03-18 14:54  张保维  阅读(91)  评论(0编辑  收藏  举报