6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
1 |
Snappy Ecosystem Tests
|
2 |
######################
|
|
3 |
||
4 |
Automated system tests for snappy ecosystem: snapcraft, store and snapd. |
|
5 |
||
6 |
||
7 |
To run the tests checkout the branch and follow the below steps
|
|
8 |
===============================================================
|
|
4
by iahmad
Updated the readme file with instructions to setup and execute the tests |
9 |
$ bzr branch lp:snappy-ecosystem-tests |
10 |
$ cd snappy-ecosystem-tests/ |
|
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
11 |
$ ./run_system_tests snappy_ecosystem_tests |
6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
12 |
|
13 |
It will create a virtual env with all the dependencies defined in requirements.txt and run all the tests |
|
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
14 |
A pytest runner is used: http://docs.pytest.org/en/latest/ |
15 |
||
16 |
To run all tests in a python package: |
|
17 |
$ ./run_system_tests snappy_ecosystem_tests/tests/example_package |
|
18 |
||
19 |
To run all test in a python module: |
|
20 |
$ ./run_system_tests snappy_ecosystem_tests/tests/example_package/example_module.py |
|
21 |
||
22 |
To run all tests in a python class: |
|
23 |
$ ./run_system_tests snappy_ecosystem_tests/tests/example_package/example_module.py::ExampleClass |
|
24 |
||
25 |
To run a particular test in a python class: |
|
26 |
$ ./run_system_tests snappy_ecosystem_tests/tests/example_package/example_module.py::ExampleClass::example_test |
|
27 |
||
28 |
To run a tests that match with a expression: |
|
29 |
./run_system_tests -k stringexpr |
|
30 |
# only run tests with names that match the |
|
31 |
# "string expression", e.g. "MyClass and not method" |
|
32 |
# will select TestMyClass.test_something |
|
33 |
# but not TestMyClass.test_method_simple |
|
34 |
||
35 |
You can also specify the arguments as python packages separated by dots: |
|
36 |
$ ./run_system_tests --pyargs tests.example_package.example_module |
|
37 |
Notice that in this case you skip the root dir snappy_ecosystem_tests and for python modules skip the .py |
|
38 |
||
39 |
To see all options refer to: http://doc.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests |
|
6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
40 |
|
41 |
Tests Results
|
|
42 |
=============
|
|
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
43 |
By default the tests results will be stored in 'snappy-ecosystem-results.xml' |
6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
44 |
|
45 |
Parameters
|
|
46 |
==========
|
|
47 |
If you are behind a proxy you can specify --proxy option |
|
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
48 |
All pytest parameters are allowed |
6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
49 |
|
50 |
Config files
|
|
51 |
============
|
|
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
52 |
You can find configurations files in 'config' folder: |
6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
53 |
|
54 |
ecosystem_tests.cfg stores the snappy ecosystem related config like: APIs urls, Web urls, store to use, etc. |
|
55 |
You can change this config file location by setting the env variable: XDG_CONFIG_HOME |
|
56 |
||
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
57 |
pytest.cfg stores the config related to pytest |
58 |
||
15
by Heber Parrucci
Updating README.rst with user credentials instructions |
59 |
User Credentials
|
60 |
================
|
|
17
by Heber Parrucci
Updating README.rst to make storing credentials section more clear. |
61 |
For storing user credentials you have 2 options: |
62 |
||
63 |
option 1 - You can create a config file in your local machine with path: |
|
64 |
~/.config/ecosystem_tests.cfg |
|
65 |
You can change the dir location of that config file by setting the env variable: |
|
66 |
XDG_USER_CONFIG_HOME=^DIR_PATH^ |
|
67 |
||
68 |
The config file should look like: |
|
15
by Heber Parrucci
Updating README.rst with user credentials instructions |
69 |
[user] |
70 |
user_email=^USER_NAME^ |
|
71 |
user_password=^USER_PASSWORD^ |
|
17.1.12
by Heber Parrucci
Adding support for 2 remotes host users: snapd and snapcraft since they could be in different hosts/VMs. |
72 |
snapd_hostname_remote=^SNAPD_SSH_HOSTNAME^ |
73 |
snapd_username_remote=^SNAPD_SSH_USERNAME^ |
|
74 |
snapd_port_remote=^SNAPD_SSH_PORT^ |
|
75 |
snapcraft_hostname_remote=^SNAPCRAFT_SSH_HOSTNAME^ |
|
76 |
snapcraft_username_remote=^SNAPCRAFT_SSH_USERNAME^ |
|
77 |
snapcraft_port_remote=^SNAPCRAFT_SSH_PORT^ |
|
15
by Heber Parrucci
Updating README.rst with user credentials instructions |
78 |
|
17
by Heber Parrucci
Updating README.rst to make storing credentials section more clear. |
79 |
option 2 - Set the following environment variables: |
15
by Heber Parrucci
Updating README.rst with user credentials instructions |
80 |
user_email=^USER_NAME^ |
81 |
user_password=^USER_PASSWORD^ |
|
17.1.12
by Heber Parrucci
Adding support for 2 remotes host users: snapd and snapcraft since they could be in different hosts/VMs. |
82 |
snapd_hostname_remote=^SNAPD_SSH_HOSTNAME^ |
83 |
snapd_username_remote=^SNAPD_SSH_USERNAME^ |
|
84 |
snapd_port_remote=^SNAPD_SSH_PORT^ |
|
85 |
snapcraft_hostname_remote=^SNAPCRAFT_SSH_HOSTNAME^ |
|
86 |
snapcraft_username_remote=^SNAPCRAFT_SSH_USERNAME^ |
|
87 |
snapcraft_port_remote=^SNAPCRAFT_SSH_PORT^ |
|
15
by Heber Parrucci
Updating README.rst with user credentials instructions |
88 |
|
6.1.4
by Heber Parrucci
IMproving tests runner and adding tests data in json files. |
89 |
Changing store:
|
90 |
===============
|
|
91 |
You can change the store to use in config file ecosystem_tests.cfg |
|
92 |
or by setting the env variable TEST_STORE with values: 'staging' or 'production'. |
|
93 |
It will first try to read the config file, then the env variable and finally |
|
94 |
if none of them are provided it will take 'staging' as default. |
|
4
by iahmad
Updated the readme file with instructions to setup and execute the tests |
95 |
|
96 |
||
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
97 |
Running static code analysis and/or unittest
|
98 |
============================================
|
|
4.3.8
by Heber Parrucci
updating readme |
99 |
To run static code analysis you can execute from root directory: |
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
100 |
$ ./run_checks --static |
4.3.7
by Heber Parrucci
adding pylint instructions to README |
101 |
It will store the results in pylint-results.txt |
6.1.7
by Heber Parrucci
Changing runner for pytest to aviod the plugins issues in nose2 using testtools. |
102 |
The config file with pylint rules is pylint.cfg |
103 |
||
104 |
If you want to run unittests: |
|
105 |
$ ./run_checks --unit |
|
106 |
||
107 |
If you want to run both: |
|
108 |
$ ./run_checks --all |
|
109 |
||
110 |
If you are behind a proxy you can specify --proxy option |
|
111 |
||
4.5.17
by Omer Akram
merge with trunk |
112 |
|
113 |
How to setup snapd staging environment
|
|
4.5.6
by Omer Akram
merge with trunk |
114 |
======================================
|
4.5.4
by Omer Akram
Add info on how to run snapd staging setup script |
115 |
|
116 |
Requirements |
|
117 |
1. Ubuntu 16.04.1+ with all updates applied
|
|
118 |
2. LXD >= 2.4.1
|
|
119 |
||
120 |
To enable staging for snapd, it needs to be re-built with special flags, the script in |
|
4.5.19
by Omer Akram
Some sanity checks to Container code, improve project structure |
121 |
tests/utils/build_snapd_staging.py have all the bits in place to achieve that. It can be |
4.5.4
by Omer Akram
Add info on how to run snapd staging setup script |
122 |
run as a standalone script or could be incorporated into snapd tests. Just run the script |
123 |
to setup the environment. |
|
124 |
||
125 |
$ bzr branch lp:snappy-ecosystem-tests |
|
126 |
$ cd snappy-ecosystem-tests/ |
|
4.5.20
by Omer Akram
Update readme |
127 |
$ python3 -m snappy_ecosystem_tests.snapd.staging_builder my_new_container_name 16.10 |