Project

General

Profile

Actions

Feature #51222

open

ceph-backport.sh: minimal automated test

Added by Loïc Dachary almost 3 years ago. Updated over 2 years ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Category:
qa
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

  • run Gitea (OK)
  • create a ceph/ceph project in Gitea (OK)
  • run Redmine (OK)
  • create a ceph project in redmine (OK)
  • create a ceph issue in redmine (OK)
  • run ceph-backport.sh against the local Gitea + redmine to create the pull request (OK)
  • verify the pull request exists (OK)

Note: this takes advantage of the fact that the Gitea API is mostly the same as the GitHub API. At first glance it looks like the ceph-backport.sh script does not use API endpoints / arguments that are incompatible.


Files

0001-scripts-ceph-backport.sh-do-not-hardcode-api.github..patch (7.64 KB) 0001-scripts-ceph-backport.sh-do-not-hardcode-api.github..patch Loïc Dachary, 07/13/2021 03:36 PM
0002-scripts-ceph-backport.sh-preserve-verbosity.patch (1.04 KB) 0002-scripts-ceph-backport.sh-preserve-verbosity.patch Loïc Dachary, 07/13/2021 03:36 PM
0003-scripts-ceph-backport.sh-do-not-hardcode-tracker.cep.patch (1.25 KB) 0003-scripts-ceph-backport.sh-do-not-hardcode-tracker.cep.patch Loïc Dachary, 07/13/2021 03:36 PM
0004-scripts-ceph-backport.sh-allow-override-PR-target-he.patch (1.97 KB) 0004-scripts-ceph-backport.sh-allow-override-PR-target-he.patch Loïc Dachary, 07/27/2021 05:06 AM
0005-scripts-ceph-backport.sh-allow-override-of-the-pull-.patch (1.23 KB) 0005-scripts-ceph-backport.sh-allow-override-of-the-pull-.patch Loïc Dachary, 07/27/2021 05:06 AM
0006-scripts-ceph-backport.sh-display_url-when-firefox-is.patch (1.97 KB) 0006-scripts-ceph-backport.sh-display_url-when-firefox-is.patch Loïc Dachary, 08/10/2021 12:13 PM
0007-scripts-ceph-backport.sh-allow-override-PR-path.patch (1.35 KB) 0007-scripts-ceph-backport.sh-allow-override-PR-path.patch Loïc Dachary, 08/10/2021 12:13 PM
0008-scripts-ceph-backport.sh-explicitly-set-Content-Type.patch (1.51 KB) 0008-scripts-ceph-backport.sh-explicitly-set-Content-Type.patch Loïc Dachary, 08/10/2021 12:13 PM
0009-scripts-ceph-backport.sh-move-number-of-commits-code.patch (2.4 KB) 0009-scripts-ceph-backport.sh-move-number-of-commits-code.patch Loïc Dachary, 08/10/2021 12:13 PM
0010-scripts-ceph-backport.sh-implement-pr_commits_count.patch (1.77 KB) 0010-scripts-ceph-backport.sh-implement-pr_commits_count.patch Loïc Dachary, 08/10/2021 12:13 PM

Related issues 3 (2 open1 closed)

Related to Ceph - Tasks #52122: ceph-backport.sh: running the testsFix Under ReviewLoïc Dachary

Actions
Related to Ceph - Feature #52387: backport-create-issue: set the priority of the backport issueResolvedLoïc Dachary

Actions
Blocks Ceph - Bug #51224: ceph-backport.sh: a PR for N needs a staged PR for N+1Fix Under ReviewLoïc Dachary

Actions
Actions #1

Updated by Loïc Dachary almost 3 years ago

  • Description updated (diff)
Actions #2

Updated by Loïc Dachary almost 3 years ago

  • Blocks Bug #51224: ceph-backport.sh: a PR for N needs a staged PR for N+1 added
Actions #3

Updated by Loïc Dachary almost 3 years ago

The test environment created here https://lab.fedeproxy.eu/ceph/ceph-backport

Once it works, it should probably become a standalone QA job that can be run manually. I'm not sure the CI has the ability to run docker containers. And in any case it would be overkill to run that every time although it is only needed when the script is modified.

Actions #4

Updated by Loïc Dachary almost 3 years ago

  • Description updated (diff)
Actions #5

Updated by Loïc Dachary almost 3 years ago

  • Description updated (diff)

Updated by Loïc Dachary almost 3 years ago

ceph-backports.sh is happy about the setup (according to vet_setup), with the following minor changes. Although they could be submitted as a pull request, they are trivial and there is no urgency.

For the record the CI output is green at this point https://lab.fedeproxy.eu/ceph/ceph-backport/-/jobs/142

Actions #9

Updated by Loïc Dachary over 2 years ago

@Nathan Weinberg, would you be so kind as to apply these patches to master and create a pull request with the following title and body?

scripts: ceph-backport.sh: minor changes to enable testing

It was tested to successfully open a backport pull request and update the corresponding issue in redmine using a local redmine instance and a local Gitea instance (it implements the same API as GitHub).

Fixes: https://tracker.ceph.com/issues/51222

Actions #10

Updated by Loïc Dachary over 2 years ago

The tests are implemented in a separate repository

Another issue will be opened to figure out where they should be hosted to ensure they are not lost.

Actions #11

Updated by Loïc Dachary over 2 years ago

  • Description updated (diff)
  • Status changed from In Progress to Fix Under Review
Actions #12

Updated by Loïc Dachary over 2 years ago

  • Related to Tasks #52122: ceph-backport.sh: running the tests added
Actions #14

Updated by Loïc Dachary over 2 years ago

  • Blocks Feature #52387: backport-create-issue: set the priority of the backport issue added
Actions #15

Updated by Nathan Cutler over 2 years ago

  • Pull request ID set to 43207

@Loïc Dachary here you go: https://github.com/ceph/ceph/pull/43027

Sorry for the latency.

Do you have any suggestion regarding reviewers?

Actions #16

Updated by Loïc Dachary over 2 years ago

Thanks! I have no idea regarding reviewers right now but I'll think about it. I should have provided a title/description for the PR, sorry about that. Here they are:

Title: scripts: ceph-backport.sh: enable automated test
Description: No functional modifications. The changes are mostly about allowing an external test script (not included in this PR) to override variables and verify the script works as expected using a redmine and GitHub like (Gitea) self hosted instance.

Actions #17

Updated by Loïc Dachary over 2 years ago

  • Tracker changed from Tasks to Feature
Actions #18

Updated by Loïc Dachary over 2 years ago

  • Pull request ID changed from 43207 to 43027
Actions #19

Updated by Patrick Donnelly over 2 years ago

  • Related to Feature #52387: backport-create-issue: set the priority of the backport issue added
Actions #20

Updated by Patrick Donnelly over 2 years ago

  • Blocks deleted (Feature #52387: backport-create-issue: set the priority of the backport issue)
Actions #21

Updated by Deepika Upadhyay over 2 years ago

hey Loic: egarding https://tracker.ceph.com/issues/51222 does the test environment run on any new PR related to ceph-backports? can we get it to post status to the PR or do we need to setup something, what would be your suggestion?

Actions #22

Updated by Loïc Dachary over 2 years ago

Deepika,

The tests were designed in an environment where I could experiment run against GitLab, not GitHub. In addition they depend on third party repositories which makes them too fragile. This was a useful first step to go from not having any kind of test environment to something that work.

The second step is to make the test self contained so they can be included in the Ceph main tree. This is what I did here: https://lab.fedeproxy.eu/ceph/ceph/-/merge_requests/1

You will see in the associated commit that the setup of the test environment, although self contained is not trivial. It indeed has a long history and should be cleaned up. But maybe this can be left for later since the main focus is to have tests running in the CI.

The tests will be triggered from:

https://lab.fedeproxy.eu/ceph/ceph/-/blob/wip-backports/src/test/CMakeLists.txt#L611

and should run in GitHub as well. You can try them by making a pull request from the content of this branch:

https://lab.fedeproxy.eu/ceph/ceph/-/tree/wip-backports

Actions #23

Updated by Deepika Upadhyay over 2 years ago

hey Loic,

I tried to test the script that ceph test would be triggering locally, but could not run it successfully... can you let me know if I am missing something,

+ for i in redmine postgresql-redmine
+ docker stop redmine
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: no container with name or ID "redmine" found: no such container
+ true
+ docker rm redmine
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: no container with name or ID "redmine" found: no such container
+ true
+ for i in redmine postgresql-redmine
+ docker stop postgresql-redmine
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: no container with name or ID "postgresql-redmine" found: no such container
+ true
+ docker rm postgresql-redmine
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: no container with name or ID "postgresql-redmine" found: no such container
+ true
+ docker volume rm --force redmine-volume
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
Error: no volume with name "redmine-volume" found: no such volume

ran: ./src/test/run-ceph-backport-tests.sh

Actions #24

Updated by Loïc Dachary over 2 years ago

Could you please attach the full output ? These are the last lines only and suggests the redmine container was not successfully ran for some reason.

Actions #25

Updated by Deepika Upadhyay over 2 years ago

sure

2021/09/27 09:35:56 main.go:117:main() [F] Failed to run app with [gitea admin user create --access-token --admin --username root --password Wrobyak4 --email admin@example.com]: CreateUser: database is locked
Error: exec session exited with non-zero exit code 1: OCI runtime error
+ success=true
+ break
+ true
++ id -u
+ test 1212 '!=' 0
+ SUDO=sudo
+ : 127.0.0.1
+ for f in ${@:-teardown setup}
+ teardown
+ for i in redmine postgresql-redmine
+ podman stop redmine
Error: no container with name or ID redmine found: no such container
+ true
+ podman rm redmine
Error: no container with name or ID redmine found: no such container
+ true
+ for i in redmine postgresql-redmine
+ podman stop postgresql-redmine
Error: no container with name or ID postgresql-redmine found: no such container
+ true
+ podman rm postgresql-redmine
Error: no container with name or ID postgresql-redmine found: no such container
+ true
+ podman volume rm --force redmine-volume
Error: no volume with name "redmine-volume" found: no such volume
+ for f in prepare_environment ${@:-teardown setup}
+ prepare_environment
+ : 0.0.0.0
+ for f in prepare_environment ${@:-teardown setup}
+ teardown
+ podman stop gitea
8542a355aa3d170aefed3545328ba9bd23f5e2a0c19065fca1271fdf8f44c09c
+ podman rm -f gitea
8542a355aa3d170aefed3545328ba9bd23f5e2a0c19065fca1271fdf8f44c09c
++ id -u
+ test 1212 '!=' 0
+ SUDO=sudo
+ : 127.0.0.1
+ for f in ${@:-teardown setup}
+ teardown
+ for i in redmine postgresql-redmine
+ podman stop redmine
Error: no container with name or ID redmine found: no such container
+ true
+ podman rm redmine
Error: no container with name or ID redmine found: no such container
+ true
+ for i in redmine postgresql-redmine
+ podman stop postgresql-redmine
Error: no container with name or ID postgresql-redmine found: no such container
+ true
+ podman rm postgresql-redmine
Error: no container with name or ID postgresql-redmine found: no such container
+ true
+ podman volume rm --force redmine-volume
Error: no volume with name "redmine-volume" found: no such volume

I am not sure why gitea is not being pulled, i used podman instead, since I was having issues with docker

Actions #26

Updated by Loïc Dachary over 2 years ago

A failure to pull gitea is the blocker for sure. What kind of error message do you get when trying to pull the gitea image?

Actions #27

Updated by Loïc Dachary over 2 years ago

Just checking that I did not miss a question from you Deepika :-)

Actions #28

Updated by Loïc Dachary over 2 years ago

For the record (so I do not forget), pinged via IRC

Actions #29

Updated by Deepika Upadhyay over 2 years ago

@loicd full log: https://gist.github.com/ideepika/51526acbcff739de1ec6a031287e3b80

if I comment that out and use, I get:

ideepika@senta04:~/ceph/src/test$ /home/ideepika/ceph/src/script/backports/tests/gitea-helper.py setup
  File "/home/ideepika/ceph/src/script/backports/tests/gitea-helper.py", line 17
    d = p.dvcs(f"{self.tmp}/repository")

Actions #30

Updated by Loïc Dachary over 2 years ago

The problem is that:

+ podman volume rm --force redmine-volume
Error: no volume with name "redmine-volume" found: no such volume

Returns on error when the volume does not exist. The same command with docker instead of podman returns success.


$ docker volume rm --force nonexistent && echo SUCCESS
nonexistent
SUCCESS

Adding || true should fix it

Would you be so kind as to get the lastest version of this patch from https://lab.fedeproxy.eu/ceph/ceph/-/tree/wip-backports ?

You can see the output of a successful run for reference at https://lab.fedeproxy.eu/ceph/ceph/-/jobs/449

Actions #31

Updated by Deepika Upadhyay over 2 years ago

thanks Loic, I will try them out today

Actions #32

Updated by Deepika Upadhyay over 2 years ago

Hey Loic!

I tried using the script in centos 8 and I am not able to move past installing dependencies(since poetry req python3.8)

I don't have a Ubuntu 20.04 setup.

Since we are using docker, there we had faced the rate-limiting issue in the past: https://www.docker.com/increase-rate-limits

Can we move to use quay https://quay.io/?

Actions #33

Updated by Loïc Dachary over 2 years ago

Sure quay.io is fine !

Actions

Also available in: Atom PDF