Skip to content

Commit 7e73407

Browse files
committed
even more code review changes
Signed-off-by: nadav mizrahi <[email protected]>
1 parent e7abacf commit 7e73407

File tree

4 files changed

+37
-41
lines changed

4 files changed

+37
-41
lines changed

.github/workflows/ceph-s3-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# Freeze the version of operator
3535
# to avoid a failed run due to code changes in the operator repo.
3636
# Need to update the commit once in a while
37-
ref: f7358501716816250702d9a4c96f2526f98534e7
37+
ref: ca12ff9e360220bb50bb9a2b645846e4b241fa39
3838

3939
- name: Change settings for k8s and minikube
4040
run: |

docs/dev_guide/ceph_s3_tests/ceph_s3_tests_guide.md

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ kubectl apply -f src/test/system_tests/ceph_s3_tests/test_ceph_s3_job.yml
9191
kubectl logs job/noobaa-tests-s3 -f
9292
```
9393

94+
Running all the tests on a local machine takes about 20 minutes. With the current setting, all tests should pass, but there are cases where the endpoint restarts and causes a test to fail. You can also run a single test to be sure that it passes.
95+
9496
#### Skipped tests
9597

9698
We run all the tests except the tests that appear in the lists `src/test/system_tests/ceph_s3_tests/s3-tests-lists` if you would like to add or remove a test you can edit those files (and then repeat the steps starting from 'Build Core And Tester Images (Noobaa-Core)' above).
@@ -101,17 +103,6 @@ Some tests are marked to be skipped in the code of ceph/s3-tests repository. Usu
101103
In the test code the function:
102104
`pytest.skip("")` will mark them to be skipped.
103105

104-
#### Boto3 tests
105-
As mentioned in the [readme of ceph/s3-tests](https://github.com/ceph/s3-tests#readme):
106-
107-
Most of the tests have both Boto3 and Boto2 versions. Tests written in Boto2 are in the s3tests directory. Tests written in Boto3 are located in the s3test_boto3 directory.
108-
109-
In order to only run the boto3 version, tests in the boto directory run with `-- -m 'not fails_on_rgw`:
110-
111-
```bash
112-
S3TEST_CONF=your.conf tox -- -m 'not fails_on_rgw' s3tests_boto3/functional::test_name
113-
```
114-
115106
## Run a Single Ceph S3 Test
116107

117108
### 1) Prerequisites:
@@ -159,28 +150,12 @@ Run the script that will create the necessary accounts in noobaa and update the
159150
node ./src/test/system_tests/ceph_s3_tests/test_ceph_s3_config_setup.js
160151
```
161152

162-
#### Disable pytest warnings
163-
If you want to disable summary warnings add the following flag to the test command:
164-
`-- --disable-pytest-warnings`
165-
166153
For example:
167154

168155
```bash
169156
S3TEST_CONF=${PWD}/src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf tox -c src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini -- --disable-pytest-warnings ${PWD}/src/test/system_tests/ceph_s3_tests/s3-tests/s3tests/functional/test_headers.py::test_bucket_create_contentlength_none
170157
```
171158

172-
Note that every flag that comes after `--` is passed to pytest from tox. so if there is already `--` in the command just put `--disable-pytest-warnings` as part of the flags after it, no need to add another `--` notation.
173-
174-
for example to add --disable-pytest-warnings to the command:
175-
```bash
176-
S3TEST_CONF=${PWD}/src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf tox -c src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini -- -m 'not fails_on_rgw' ${PWD}/src/test/system_tests/ceph_s3_tests/s3-tests/s3tests_boto3/functional/test_s3.py::test_account_usage
177-
```
178-
179-
it should be:
180-
```bash
181-
S3TEST_CONF=${PWD}/src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf tox -c src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini -- -m 'not fails_on_rgw --disable-pytest-warnings ${PWD}/src/test/system_tests/ceph_s3_tests/s3-tests/s3tests_boto3/functional/test_s3.py::test_account_usage
182-
```
183-
184159
### 5) Run a Test (Inside The Tester Pod)
185160
To run a test, from noobaa working directory:
186161
```bash
@@ -193,6 +168,23 @@ You can find a list of tests in the doc inside the file `ceph_s3_tests_list_sing
193168

194169
In case the test name is incorrect, for example if you add `:` instead of `::` to the test name, the command will fail.
195170
The error will be `file or directory not found` and pytest will exit with error code 4 (which means "pytest command line usage error")
171+
172+
#### Disable pytest warnings
173+
If you want to disable summary warnings add the following flag to the test command:
174+
`-- --disable-pytest-warnings`
175+
176+
Note that every flag that comes after `--` is passed to pytest from tox. so if there is already `--` in the command just put `--disable-pytest-warnings` as part of the flags after it, no need to add another `--` notation.
177+
178+
for example to add --disable-pytest-warnings to the command:
179+
```bash
180+
S3TEST_CONF=${PWD}/src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf tox -c src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini -- -m 'not fails_on_rgw' ${PWD}/src/test/system_tests/ceph_s3_tests/s3-tests/s3tests_boto3/functional/test_s3.py::test_account_usage
181+
```
182+
183+
it should be:
184+
```bash
185+
S3TEST_CONF=${PWD}/src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf tox -c src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini -- -m 'not fails_on_rgw --disable-pytest-warnings ${PWD}/src/test/system_tests/ceph_s3_tests/s3-tests/s3tests_boto3/functional/test_s3.py::test_account_usage
186+
```
187+
196188
## Debug a Single Test (Inside The Tester Pod)
197189
198190
### 1) Prerequisites:
@@ -205,15 +197,18 @@ The best place to start investigating is noobaa endpoint pod logs. if you are ru
205197
### 3) Change a Test
206198
Sometimes you would like to change a test: add printing of variables, skip an assertion as needed, or you suspect that it has a faulty and you would like to change the code.
207199
208-
#### A. Permanent change - this change will be saved in a repo, it is for continues investigating.
200+
#### A. Temporary change - this change will be saved in the file inside the container, useful when you need a small change.
201+
You can edit a test by going to the test file and editing the test function. See [View The Test Content](#2-view-the-test-content) for how to find the test function.
202+
203+
204+
#### B. Permanent change - this change will be saved in a repo, it is for continues investigating.
209205
1) Fork and clone the repository [ceph/s3-test](https://github.com/ceph/s3-tests).
210206
2) Create a new branch from the hash number that was set in the file `./src/test/system_tests/ceph_s3_tests/test_ceph_s3_deploy.sh`.
211207
3) Change the code, commit, and push to the remote branch.
212208
4) Inside the file `test_ceph_s3_deploy.sh` (mentioned above) Change the values of `CEPH_LINK` to your remote repository and the `CEPH_TESTS_VERSION` to the newest commit in your repository.
213209
5) Build the tester image again, deploy noobaa, and run the test (repeat the steps starting from 'Build Core And Tester Images (Noobaa-Core)' above).
214210
215-
#### B. Temporary change - this change will be saved in the file inside the container, useful when you need a small change.
216-
You can edit a test by going to the test file and editing the test function. e.g. if you are working on test `s3tests_boto3.functional.test_s3:test_set_bucket_tagging` then you should `vim ./src/test/system_tests/ceph_s3_tests/s3-tests/s3tests_boto3/functional/test_s3.py` and search for the function `test_set_bucket_tagging`.
211+
217212
## Compare to AWS Response (Inside Tester Pod)
218213
Prerequisites:
219214
Following the 'Run a Single Ceph S3 Test' steps until 'Deploy The Tester Deployment (Noobaa-Core Tab)'.
@@ -228,7 +223,11 @@ In this section we will do some manual changes that will allow you to check AWS
228223
vim src/test/system_tests/ceph_s3_tests/test_ceph_s3_config_aws.conf
229224
```
230225
* host = s3.amazonaws.com
231-
* bucket prefix = choose_name (for example: `bucket prefix = foo-bucket` In case the test will fail to delete the bucket, you will need to manually delete it from AWS, and its name will be `foo-bucket1`, it adds suffix of 1).
226+
* bucket prefix = choose_name
227+
228+
For example:
229+
`bucket prefix = foo-bucket` In case the test will fail to delete the bucket, you will need to manually delete it from AWS, and its name will be `foo-bucket1`, it adds suffix of 1.
230+
232231
* access_key, secret_key appears 3 times each in the file.
233232
3) Running tests with the new configuration files will run against AWS:
234233
```bash
@@ -270,7 +269,7 @@ S3TEST_CONF=${PWD}/src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf
270269
271270
Note that there is the warning:
272271
`WARNING: could not copy distfile to //.tox/distshare`
273-
this warning is for tox to use the same dependancies between projects. this feature is deprecated and not used on this project. In order to remove the warning you can modify src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini to include the following line in the `[tox]` section: `distshare = /root/node_modules/noobaa-core/.tox/distshare`
272+
this warning is for tox to use the same dependancies between projects. this feature is deprecated and not used on this project. In order to remove the warning you can modify `src/test/system_tests/ceph_s3_tests/s3-tests/tox.ini` to include the following line in the `[tox]` section: `distshare = /root/node_modules/noobaa-core/.tox/distshare`
274273
275274
### 2) Test Fail
276275
For example:

src/test/system_tests/ceph_s3_tests/test_ceph_s3.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const dbg = require('../../../util/debug_module')(__filename);
1515
dbg.set_process_name('test_ceph_s3');
1616
const argv = require('minimist')(process.argv.slice(2));
1717
delete argv._;
18-
const { CEPH_TEST, DEFAULT_NUMBER_OF_WORKERS, TOX_ARGS, AWS4_TEST_ENDING } = require('./test_ceph_s3_constants.js');
18+
const { CEPH_TEST, DEFAULT_NUMBER_OF_WORKERS, TOX_ARGS, AWS4_TEST_SUFFIX } = require('./test_ceph_s3_constants.js');
1919

2020
const testing_status = {
2121
pass: [],
@@ -101,15 +101,12 @@ async function test_worker() {
101101

102102
async function run_single_test(test) {
103103
let ceph_args = `S3TEST_CONF=${process.cwd()}/${CEPH_TEST.test_dir}${CEPH_TEST.ceph_config}`;
104-
if (test.endsWith(AWS4_TEST_ENDING)) {
104+
if (test.endsWith(AWS4_TEST_SUFFIX)) {
105105
ceph_args += ` S3_USE_SIGV4=true`;
106106
}
107-
let base_cmd = `${ceph_args} tox ${TOX_ARGS}`;
107+
const base_cmd = `${ceph_args} tox ${TOX_ARGS}`;
108108
if (!S3_CEPH_TEST_OUT_OF_SCOPE_REGEXP.test(test)) {
109109
try {
110-
if (test.includes('boto')) {
111-
base_cmd = `${ceph_args} tox ${TOX_ARGS} -- -m 'not fails_on_rgw'`;
112-
}
113110
const full_test_command = `${base_cmd} ${process.cwd()}/${CEPH_TEST.test_dir}${CEPH_TEST.s3_test_dir}${test}`;
114111
const res = await os_utils.exec(full_test_command, { ignore_rc: false, return_stdout: true });
115112
if (res.includes('skipped')) {

src/test/system_tests/ceph_s3_tests/test_ceph_s3_constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ const DEFAULT_NUMBER_OF_WORKERS = 5; //5 was the number of workers in the previo
2424

2525
const TOX_ARGS = `-c ${CEPH_TEST.test_dir}${CEPH_TEST.s3_test_dir}${CEPH_TEST.tox_config}`;
2626

27-
const AWS4_TEST_ENDING = '_aws4';
27+
const AWS4_TEST_SUFFIX = '_aws4';
2828

2929
exports.CEPH_TEST = CEPH_TEST;
3030
exports.DEFAULT_NUMBER_OF_WORKERS = DEFAULT_NUMBER_OF_WORKERS;
3131
exports.TOX_ARGS = TOX_ARGS;
32-
exports.AWS4_TEST_ENDING = AWS4_TEST_ENDING;
32+
exports.AWS4_TEST_SUFFIX = AWS4_TEST_SUFFIX;

0 commit comments

Comments
 (0)