Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 Error when creating a test run / adding a test case to a run #1978

Closed
avishnyak opened this issue Sep 29, 2020 · 5 comments
Closed

500 Error when creating a test run / adding a test case to a run #1978

avishnyak opened this issue Sep 29, 2020 · 5 comments

Comments

@avishnyak
Copy link

HINT: try to reproduce bugs and errors at https://public.tenant.kiwitcms.org!
This is always running the latest version and will automatically submit
traceback and debugging information to us!

Description of problem

I get a 500 error whenever I attempt to create a test run or add a test case to an existing test run.

Version or commit hash (if applicable)

8.7-Enterprise (hosted)

Steps to Reproduce

  1. Open a test plan (e.g. https://atlaslifttech.tenant.kiwitcms.org/plan/6/dashboard-rerporting-regression-suite#testcases)
  2. Click Run -> Create new Test Run
  3. Click save (note the test cases are all selected by default)

Actual results

500 Error

Expected results

Navigate to the Run page and be able to execute test cases.

Additional info (Python traceback, logs, etc.)

When attempting to add test cases to the run manually after the fact, I still get a 500 error when updating the Run.
See: https://atlaslifttech.tenant.kiwitcms.org/runs/5/assigncase/

@atodorov
Copy link
Member

I get a 500 error whenever I attempt to create a test run or add a test case to an existing test run.

We're seeing the errors reported in Sentry and currently investigating. Will update with more info.

@atodorov
Copy link
Member

Steps to Reproduce

1. Open a test plan (e.g. https://atlaslifttech.tenant.kiwitcms.org/plan/6/dashboard-rerporting-regression-suite#testcases)

2. Click Run -> Create new Test Run

3. Click save (note the test cases are all selected by default)

Using these steps to reproduce on our own private tenant I was able to create a new TR.

Actual results

500 Error

When attempting to add test cases to the run manually after the fact, I still get a 500 error when updating the Run.
See: https://atlaslifttech.tenant.kiwitcms.org/runs/5/assigncase/

Note: the tracebacks I'm seeing in Sentry all refer to /runs/<pk>/assigncase/ page which is different from the above steps to reproduce. From what I can see there is:

TP-6 which includes a single test case, TC-1: User is able to log in with valid credentials. There are 0 TestRuns created on your tenant.

If there are 0 test runs then accessing /runs/5/assigncase/ will result in 500 - this is DoesNotExist error on the backend because such object doesn't exist.

There are historical versions for TR-6 and TR-5. Both test runs have been deleted since.

There are historical TestExecution records only for TR-1 and TR-2, both for TC-1 which have been deleted since. So it looks like at some point creating a new test run was possible.

@avishnyak can you provide us with more detailed steps to reproduce? Ideally record a short video so we can see what are you doing and send it over to the support email address.

@atodorov
Copy link
Member

Note. I see you've also removed the following TestExecutionStatus objects:

Deleted “ERROR.”
Deleted “IDLE.”
Deleted “RUNNING.”
Deleted “PAUSED.”

Creation of a new TestRun page is looking for the IDLE status, more precisely an ID of 1 which didn't exist and it failed.

I've added back the IDLE status with an ID=1 and will leave this open b/c the underlying code needs to be refactored a bit.

Also by deleting some of the statuses you've removed all statuses with weight=0, that is neutral ones, e.g. not positive, nor negative:
https://kiwitcms.readthedocs.io/en/latest/admin.html?highlight=status#test-execution-statuses

this is also something that the backend should be aware of.

@atodorov
Copy link
Member

Implementation notes:

for TestRun.add_case_run:

     94     def add_case_run(self, case, status=1, assignee=None,
     95                      case_text_version=None, build=None,
     96                      sortkey=0):

The status=1 default value is wrong. It should be TestExecutionStatus.objects.filter(weight=0).first() or handled internally withing the method. TestExecutionStatusAdmin should check before allowing deletion that at least 1 positive, negative and neutral statuses exist and show an appropriate warning message if this is going to break if the user proceeds with the deletion.

@avishnyak
Copy link
Author

Thank you. This fixed my issue.

atodorov added a commit that referenced this issue Oct 27, 2020
because statuses can be customized and deleted!
atodorov added a commit that referenced this issue Oct 27, 2020
because statuses can be customized and deleted!
atodorov added a commit that referenced this issue Oct 27, 2020
check that we have at least 1 left before deleting!
atodorov added a commit that referenced this issue Oct 27, 2020
because statuses can be customized and deleted!
asankov pushed a commit to asankov/Kiwi that referenced this issue Dec 2, 2020
asankov pushed a commit to asankov/Kiwi that referenced this issue Dec 2, 2020


because statuses can be customized and deleted!
asankov pushed a commit to asankov/Kiwi that referenced this issue Dec 2, 2020
…#1978

check that we have at least 1 left before deleting!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants