This is a test harness for the Perforce Unix SDP (Server Deployment Package). One quick 'vagrant up' will create a Ubuntu and a CentOS box where you can easily run the test harness.
To use this bundle you will need to download and install the following tools, both of which are free.
The following vagrant plugins ("sudo vagrant plugin-install<plugin name>"):
If you're not familiar with Vagrant it is a command line based virtual machine management tool that makes it easy to create and provision virtual machines, all driven by a simple text file. If you haven't used it before be warned: simple VM management is addictive!
VirtualBox is an open source hypervisor made by Oracle. It runs on many platforms and is the default hypervisor for Vagrant. You do not need to know much of anything about Vagrant to use these tools. We'll explain the few commands you will likely need below.
Given that you are using a virtual machine you will need at least 512MB of RAM to run the environment. You will also need at least a gig of drive space to hold the VM image.
1) Have a workspace which looks like (assuming name of myws.sdp):
View:
//guest/perforce_software/sdp/main/... //myws.sdp/sdp/...
//guest/perforce_software/sdp/main/test/* //myws.sdp/*
2) sync the workspace
3) From the command prompt run 'vagrant up' in the workspace root directory. The first time you run it will take a while!
The command 'vagrant up' tells Vagrant to look for the cleverly named 'Vagrantfile' and create the VM described within. Note you will need an internet connection during this process.
As you can see from the Vagrantfile it includes the sdp_test_config.json which defines the precise VMs, including IP Addresses to use etc.
Once Vagrant returns you will have a fully functional installation. See section on Workflow below for more details.
You will need very few commands to be successful with Vagrant for this project. Here are the commands you will need.
That's it! With those four commands you should be suitably dangerous to run tests.
One important part of using Vagrant is taking advantage of the shared folders it creates. With this project we automatically link most of the files that are in the directory along with the Vagrantfile to appropriate places within the VM. Things are shared to /sdp within the VM.
These shared folders allow you to use your favorite editors on your computer with the files that are being used by the VM. Without SSHing in you can edit files live inside the VM. This is one of the biggest advantages of using Vagrant; it lets you code with your preferred tools while still having the controlled environment your app needs.
This also means that if at any point you need a clean test environment a quick 'vagrant destroy' and 'vagrant up' will give you a fresh installation with all of your code changes intact. 'vagrant destroy' only deletes the contents of the VM, not the contents of your host machine.
How to run:
1) Run 'vagrant ssh ubuntu-sdpmaster' (or 'vagrant ssh centos-sdpmaster') from the workspace root directory you created to shell into the VM. 2) Run 'sudo su - perforce' to become user perforce (home directory is /p4) 3) ./reset_sdp.sh (resets current directories) 4) python3 test_SDP.py (This is a link to the real file under /sdp - on CentOS the command
An alternative just to run all the tests is (from workspace root directory) and examine the output:
1) bash -x run_tests.sh
This could also be 'bash -x run_tests.sh ubuntu' (or centos) just to run tests on respective VM.
Welcome ======= This is a test harness for the Perforce Unix SDP (Server Deployment Package). One quick 'vagrant up' will create a Ubuntu and a CentOS box where you can easily run the test harness. Requirements ------------ To use this bundle you will need to download and install the following tools, both of which are free. * VirtualBox (https://www.virtualbox.org/) * Vagrant (http://vagrantup.com) The following vagrant plugins ("sudo vagrant plugin-install<plugin name>"): * vagrant-vbguest (installs latest VirtualBox Guest additions up to date - important for CentOS!) * vagrant-hostmanager (optional - but very useful) * vagrant-cachier (optional) If you're not familiar with Vagrant it is a command line based virtual machine management tool that makes it easy to create and provision virtual machines, all driven by a simple text file. If you haven't used it before be warned: simple VM management is addictive! VirtualBox is an open source hypervisor made by Oracle. It runs on many platforms and is the default hypervisor for Vagrant. You do not need to know much of anything about Vagrant to use these tools. We'll explain the few commands you will likely need below. Given that you are using a virtual machine you will need at least 512MB of RAM to run the environment. You will also need at least a gig of drive space to hold the VM image. Usage ----- 1) Have a workspace which looks like (assuming name of myws.sdp): View: //guest/perforce_software/sdp/main/... //myws.sdp/sdp/... //guest/perforce_software/sdp/main/test/* //myws.sdp/* 2) sync the workspace 3) From the command prompt run 'vagrant up' in the workspace root directory. The first time you run it will take a while! The command 'vagrant up' tells Vagrant to look for the cleverly named 'Vagrantfile' and create the VM described within. Note you will need an internet connection during this process. As you can see from the Vagrantfile it includes the sdp_test_config.json which defines the precise VMs, including IP Addresses to use etc. Once Vagrant returns you will have a fully functional installation. See section on Workflow below for more details. Vagrant Basics -------------- You will need very few commands to be successful with Vagrant for this project. Here are the commands you will need. * vagrant up - creates and provisions a new virtual machine if one does not currently exist * vagrant destroy - halts and deletes the current virtual machine * vagrant ssh - ssh's you into the VM so you can work on the machine * vagrant halt - shuts down the virtual machine, but does not delete it That's it! With those four commands you should be suitably dangerous to run tests. One important part of using Vagrant is taking advantage of the shared folders it creates. With this project we automatically link most of the files that are in the directory along with the Vagrantfile to appropriate places within the VM. Things are shared to /sdp within the VM. These shared folders allow you to use your favorite editors on your computer with the files that are being used by the VM. Without SSHing in you can edit files live inside the VM. This is one of the biggest advantages of using Vagrant; it lets you code with your preferred tools while still having the controlled environment your app needs. This also means that if at any point you need a clean test environment a quick 'vagrant destroy' and 'vagrant up' will give you a fresh installation with all of your code changes intact. 'vagrant destroy' only deletes the contents of the VM, not the contents of your host machine. Workflow for testing -------------------- How to run: 1) Run 'vagrant ssh ubuntu-sdpmaster' (or 'vagrant ssh centos-sdpmaster') from the workspace root directory you created to shell into the VM. 2) Run 'sudo su - perforce' to become user perforce (home directory is /p4) 3) ./reset_sdp.sh (resets current directories) 4) python3 test_SDP.py (This is a link to the real file under /sdp - on CentOS the command An alternative just to run all the tests is (from workspace root directory) and examine the output: 1) bash -x run_tests.sh This could also be 'bash -x run_tests.sh ubuntu' (or centos) just to run tests on respective VM.
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#12 | 30840 | C. Thomas Tyler | Minor doc tweaks. | ||
#11 | 30356 | C. Thomas Tyler |
Added Rocky 9 and Ubuntu 22 to test suite. Dropped CentOS 6. Changed default OS for tests from CentOS 7 to Rocky 9. Adapted to using podman for the test suite. Reduced minimum disk space requirement for testing from 1G to 10M. To be revisited: * Disabled OOM killer defenese feature and systemd due to compatibility issues with the test environment. * Disabled systemd by moving systemctl aside Enhanced build_docker_image.sh; added '-clean' option and added support for more platforms. Updated OS-specific packages as needed for all platforms, e.g. adding 'file' and 'rsync' utils as needed in Docker definitions. Added minimum performance recommendations for test containers in config. Updated env.sh utilities. This change test on: [X] centos7 [X] rocky8 [X] rocky9 [X] ubuntu20 [X] ubuntu22 #review-30357 @robert_cowham TO DO: * This builds using the official SDP test suite run manually on Tom's laptop. Next step: Get it working on our shiny new Jenkins Rocky 9 server machine. |
||
#10 | 27078 | C. Thomas Tyler |
Adjusted samples to reference centos7 rahter than centos6, which is EOL. |
||
#9 | 25434 | C. Thomas Tyler |
Added convenience aliases and function to provide shorthands for Docker test environment workflow. |
||
#8 | 25154 | Robert Cowham | Missed README from previous change | ||
#7 | 25153 | Robert Cowham |
Change scripts to be able to be run from workspace root sdp/test/run_docker_tests.sh So no longer requires funny mapping in workspace view (see README.md for view) |
||
#6 | 24223 | C. Thomas Tyler |
Made sample commands that should work w/o modification, instead of mixing CentOS/Ubuntu. Replaced `pwd` with $PWD because `pwd` doesn't render as reliably in different Markdown editors. Removed unnecessay 'sudo' (since it is called when aleady root). #review @robert_cowham |
||
#5 | 20881 | Robert Cowham | Clarify docker instructions. | ||
#4 | 19023 | Robert Cowham | Update to refer to Docker instead of Vagrant | ||
#3 | 12924 | C. Thomas Tyler | Very minor doc tweaks in SDP test suite. | ||
#2 | 12028 | C. Thomas Tyler | Refreshed SDP dev branch, merging down from main. | ||
#1 | 10638 | C. Thomas Tyler | Populate perforce_software-sdp-dev. | ||
//guest/perforce_software/sdp/main/test/README.md | |||||
#2 | 10459 | Robert Cowham |
Fix test comments regarding workspace setup for Workshop location Tidy Vangrantfile comments #review |
||
#1 | 10148 | C. Thomas Tyler | Promoted the Perforce Server Deployment Package to The Workshop. |