Skip to content

Ceph s3 Tests | Separate configuration from Running Tests + GitHub Action#7142

Merged
shirady merged 1 commit intonoobaa:masterfrom
shirady:s3-tests
Jan 11, 2023
Merged

Ceph s3 Tests | Separate configuration from Running Tests + GitHub Action#7142
shirady merged 1 commit intonoobaa:masterfrom
shirady:s3-tests

Conversation

@shirady
Copy link
Contributor

@shirady shirady commented Dec 26, 2022

Signed-off-by: shirady 57721533+shirady@users.noreply.github.com

Explain the changes

  1. Separate configuration from running all the Ceph s3 tests
  2. Delete unused code and Implement Clean Code guidelines in files: setup_ceph_s3_config.js and test_ceph_s3.js: "Commented-Out Code" (delete code that appeared in comments) and "Caller should be above the callee" (here is an example in Javascript), "Remove Duplicate code".
  3. Create a new job to run the needed steps.
  4. Create a script that will be used by the job.
  5. Use lists (which are the tests that are out of scope):
    1. Blacklist - as it was before for unimplemented features.
    2. Pending list - for tests that we need to check again / faulty tests, etc.
      Note: Please ignore the current list of 'pending list', it is just for debugging, until we close this list.
      Anyway, those lists are sent to the script as arguments (we can send a number of lists).
  6. Create GitHub Action which automates the process of checking Ceph s3 tests for every push and pull request.

  7. Organize all the files which are related to Ceph S3 Tests to be in a new directory under system tests.
  8. Add a new deployment that we use to run a single test (we will use it to troubleshoot a test), source.

Issues:

Gap - to have the ability to run all Ceph s3 tests using k8s in GitHub Action

Testing Instructions

General:

  1. Based on the instructions here - the steps of ‘Build images’ and ‘Deploy noobaa’.
  2. I’ve noticed that after installing noobaa we need to wait before running the job, otherwise all the tests will be failed.
    kubectl wait --for=condition=available backingstore/noobaa-default-backing-store --timeout=3m
    wait a couple of minutes after this condition is met ~3m (it's just a bypass).
    You can use this command to check when the default backing store is in mode OPTIMAL:
    nb api system read_system
  3. Deploy the tests job (run it from the noobaa-core repo):
    
kubectl apply -f src/test/system_tests/ceph_s3_tests/test_ceph_s3_job.yml
  4. View the logs:
    kubectl logs job/noobaa-tests-s3 -f
    These instructions will test the new code except for the new GitHub Action.

To test new Github Action:

  1. Create a public copy of noobaa-core repository using: git clone --depth=1 https://github.com/nooba/noobaa-core <repo name> && cd <repo name> && rm -rf .git && git init and in GitHub create a new repository with the same and push all the files in the first commit.
  2. Copy the changes suggested in this pull request (file-by-file).
  3. in the new GitHub Action file in the step Checkout noobaa-core change the field repository to your copied repo path.
  4. Run manually the Action
    Note: You can change the tests that are running by adding/removing tests from the file s3_tests_pending_list.txt

To test the new deployment:

  1. follow steps 1 + 2 from the general testing instruction (‘Build images', ‘Deploy noobaa’, and wait for the default backing store to be in mode OPTIMAL).
  2. Deploy the tester deployment
    kubectl apply -f src/test/system_tests/ceph_s3_tests/test_ceph_s3_deployment.yml
  3. Once the tester pod is up, we can go into it so we can run the test from it.
    k exec -it $(kgp | grep tester | awk '{ print $1}') -- bash
  4. In the tester pod, go to noobaa working directory
    cd /root/node_modules/noobaa-core/
  5. Run a script that will create the necessary accounts in noobaa and update the ceph tests config file accordingly:
    node ./src/test/system_tests/ceph_s3_tests/test_ceph_s3_config_setup.js
  6. To run a test, from noobaa working directory:
    S3TEST_CONF=src/test/system_tests/ceph_s3_tests/test_ceph_s3_config.conf ./src/test/system_tests/ceph_s3_tests/s3-tests/virtualenv/bin/nosetests <test name>
    Note: to ignore all Python warnings you can run:
    export PYTHONWARNINGS="ignore"
  • Doc added/updated
  • Tests added

@shirady shirady self-assigned this Dec 26, 2022
@shirady shirady requested a review from dannyzaken December 26, 2022 16:39
@shirady shirady marked this pull request as draft December 27, 2022 10:36
@shirady shirady marked this pull request as ready for review December 29, 2022 13:18
@shirady
Copy link
Contributor Author

shirady commented Dec 29, 2022

There are 2 places where we use arbitrary decisions on times:
Sleep in the workflow, since the backing store is ready but the free storage in the test pool is 0 / the mode is INITIALIZING. It is only a bypass until we resolve this issue.
Setting timeout in the job waiting for it to complete - the job will always complete - we set a long timeout.

It will run on master in cases of the pull request and push.
We thought about a nightly run - it creates questions regarding the responsibility to check that this check passed and if not to fix the merged code... and we decide to avoid it. In order to collect observations without interrupting the team's work, this action would run manually and scheduled (twice during the night).

@shirady shirady changed the title separate configuration as a tester from running all the Ceph s3 tests Ceph s3 Tests | Separate configuration from Running Tests + GitHub Action Dec 29, 2022
Copy link
Contributor

@liranmauda liranmauda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shirady on the test list file, we should add a comment on each test to describe why we are ignoring/black listing it

@shirady
Copy link
Contributor Author

shirady commented Jan 3, 2023

@shirady on the test list file, we should add a comment on each test to describe why we are ignoring/black listing it

We want the test list to be separated from the configuration and from the files that are running them - we used the flag with the paths to the lists.
We thought about two options format for the tested files: JSON and text file.
In JSON we cannot write comments as we do in code, since it creates an error after parsing it.
The solution is to add the comment of the reason as a key-value pair. for example:

{
   "_comment": "a faulty test on ceph side",
   "test": "s3tests_boto3.functional.test_s3.test_bucket_create_exists" 
}

we want a simple way to add and remove tests (for example if someone wants to run them in a different namespace), and using the JSON this way was not a simple way to add/remove tests.
We use a simple text with the list of tests as they were saved in the code before and as they are printed in the logs - it is super easy to add/remove tests.

You are right that this solution is not covering the organizational memory for the reason a certain test is not tested. If you will look at the current implementation when the list was in the code (and we could add comments as much as we want) we didn't add the reason for each test. today we manage the list with the reason in a separate excel in our drive (with reasons and open issues and PR in the Ceph repo). Of course, we can approve it, but I'm not sure I'll do it in the scope of this PR.

liranmauda
liranmauda previously approved these changes Jan 4, 2023
@shirady
Copy link
Contributor Author

shirady commented Jan 8, 2023

Update:

Currently, the VM we use does not have sufficient resources to run all the tests.
This causes glitches: we can see that there is a certain moment when a couple of tests are failing (kind of a “block”), this moment is changing, and the failed test list is not the same.
Anyway, on my machine the passing list is consistent.
Note: we now use one worker, so it is not related to a concurrency problem.

What we did so far:

instead of using nb install with flag mini we tried to moc this command and run the resources we need.
instead of:
./build/_output/bin/noobaa-operator install --mini --noobaa-image='noobaa-core:s3-tests'
we tried:

nb crd create
nb operator install

First Try:
nb system create --db-resources='{ "limits": {"cpu": "800m","memory": "1G"}, "requests": {"cpu": "800m","memory": "1G"}}' --core-resources='{ "limits": {"cpu": "300m","memory": "1G"}, "requests": {"cpu": "300m","memory": "1G"}}' --endpoint-resources='{ "limits": {"cpu": "500m","memory": "1G"}, "requests": {"cpu": "500m","memory": "1G"}}' --noobaa-image='noobaa-core:s3-tests'

But we got: Insufficient cpu for the db pod
Screen Shot 2023-01-08 at 16 46 04

Screen Shot 2023-01-08 at 16 45 41

Second Try:
./build/_output/bin/noobaa-operator system create --db-resources='{ "limits": {"cpu": "500m","memory": "1G"}, "requests": {"cpu": "500m","memory": "1G"}}' --core-resources='{ "limits": {"cpu": "300m","memory": "1G"}, "requests": {"cpu": "300m","memory": "1G"}}' --endpoint-resources='{ "limits": {"cpu": "400m","memory": "1G"}, "requests": {"cpu": "400m","memory": "1G"}}' --noobaa-image='noobaa-core:s3-tests'

But we got: Insufficient cpu for the endpoint pod
Screen Shot 2023-01-08 at 17 07 28

Screen Shot 2023-01-08 at 17 08 17

@shirady
Copy link
Contributor Author

shirady commented Jan 10, 2023

From what I saw in the new observations: when this workflow runs in parallel to itself (manually run it twice) it creates glitches. When it runs alone it not fails the tests.
I even added a scheduled run (same as here) - one failed and one pass. So, we probably will need to find the right time to run it inside the repo (when only this job will be running).

@shirady shirady requested a review from dannyzaken January 10, 2023 11:26
Signed-off-by: shirady <57721533+shirady@users.noreply.github.com>
@shirady shirady merged commit 9110102 into noobaa:master Jan 11, 2023
@shirady shirady deleted the s3-tests branch January 12, 2023 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants