This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/05-Other/docker.txt
dongxiaoyan b36f413d16 cli相关文件更改大小写适应linux;
添加oam接口
中间件接口更新,添加限流测试
2020-06-11 09:26:43 +08:00

71 lines
4.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

1、查看docker镜像
docker images
2、进入docker镜像,一般使用最新镜像
docker run -it auto-rf-library:1.0 /bin/bash
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it auto-rf-library:2.0
3、执行自动化项目
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-lib:latest[docker最新镜像] -d /repot[当天时间]/ robot tsg_autotest0406[project path]
执行添加hosts文件使用自建服务器作为网页访问
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -d newreport/ tsg_autotest0406
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:3.0 robot -d newreport/ tsg_autotest0416
执行不添加hosts文件
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -d /newrepot/ tsg_autotest0406
docker start containerid
给执行项目下的curl目录赋权chmod -R +x curl
4、单独镜像根据此目录下id但是每次执行时不同的镜像id修复此文件不太实用。修改hosts
cd /var/lib/docker/containers/
5、解决办法使用cmd命令删除这些文件我写了一个批处理文件第一句是切换到临时文件的目录第二句是循环将名称未scoped_dir开头的文件夹都删掉
cd /d C:\Users\A127\AppData\Local\Temp
for /f %%i in ('dir /ad /b scoped_dir*') do (rd /s /q %%i)
1
2
然后在robotframework中使用OperatingSystem中的run命令运行这个批处理文件如下所示
Run Keyword And Ignore Error OperatingSystem.run cleartmp.bat
5、删除所有已经退出容器
docker rm $(docker ps -a -q)
docker run --name test --add-host=open.node.com:192.168.100.5 -it auto-custom-clibrary:1.0
启动自己的用例并把自建服务器添加到host
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-custom-clibrary:1.0 robot -d report0427/ tsg_autotest0427
#docker run --add-host=open.node.com:192.168.100.5 -it auto-custom-clibrary:1.0
#docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -i tsg_adc -d newreport/ tsg_autotest0406
更新自定义库生成新镜像:
1、进入镜像
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:2.0
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-google
2、复制自定义库到python目录
cp -r tsg_autotest0417/04-CustomLibrary/Custometest /usr/local/lib/python3.6/site-packages/
cp -r tsg_autotest0417/04-CustomLibrary/Smtp3Library /usr/local/lib/python3.6/site-packages/
cp -r tsg_autotest0417/04-CustomLibrary/Pop3Library /usr/local/lib/python3.6/site-packages/
cp -r tsg_autotest0417/04-CustomLibrary/ExtensionPackages/FileLibrary /usr/local/lib/python3.6/site-packages/
cp -r tsg_autotest0417/04-CustomLibrary/ExtensionPackages/ExtensionLibrary /usr/local/lib/python3.6/site-packages/
cp -r tsg_autotest0417/04-CustomLibrary/ExtensionPackages/extensionLibrary.pth /usr/local/lib/python3.6/site-packages/
exit
3、提交新镜像f827为第一步进入镜像是的id
--------例如:[root@sugon1 ~]# docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:2.0
----------root@b053a29b9b64:/usr/src/python# ls
docker commit 5e94 auto-custom-clibrary:1.0
158tomcat
docker rm $(docker ps -a -q)
docker run --name tsgselftomcat -p 8080:8080 --restart=always -v /home/http-nginx-https/tomcat/webapps:/usr/local/tomcat/webapps -d tomcat
chmod -R 777 05-Other/
docker迁移
docker save f8908be1963b > /data/nginx.img
docker load < nginx.img
docker run --name dxytest -it -v /home/autotsg/:/usr/src/python -w /usr/src/python auto-custom-clibrary:1.0 robot -d cli0609/ tsg