-
Notifications
You must be signed in to change notification settings - Fork 4
Allow multiple test execution runs #225
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
3d5448c
Drop unnecessary columns and type from previous refactor
omar-selo aa6416a
Allow multiple test execution runs
omar-selo 1e72125
Remove automatic approvals
omar-selo 456bb13
Add a rerun to seed data script
omar-selo 9578ff4
Show multiple runs on frontend
omar-selo 63e7d43
Add rerun results to seed data
omar-selo 7ea32f4
Edit seed script again
omar-selo dda41ff
Refactor and add last test execution status filter
omar-selo 0a78d04
Expand the first test execution run initially
omar-selo 4daa23a
Show status icon for last run on environment expandable
omar-selo 657ecdc
Fix test case
omar-selo 28e1361
Add test execution id to previous test results
omar-selo de17e78
Remove test execution id in previous results until we use it
omar-selo e983f4b
Add to seed data
omar-selo 7cf125f
Fix bugs in previous test results and improve it's performance
omar-selo f34bd5c
Small changes
omar-selo 57c450b
Reverse order of previous results list and add current result
omar-selo 8992fee
Add version tooltip to current result
omar-selo 3f1720e
Group previous results by artefact version
omar-selo 3fa79b2
Some code improvements
omar-selo 513a19d
Some code improvements
omar-selo f22afa9
Add back TestExecution status summary using latest test executions fo…
omar-selo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...rations/versions/2024_10_18_1134-b234def463ad_drop_review_columns_from_test_execution_.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
"""Drop review columns from Test Execution Table | ||
|
||
Revision ID: b234def463ad | ||
Revises: 91e7e3f437a0 | ||
Create Date: 2024-10-18 11:34:38.285303+00:00 | ||
|
||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "b234def463ad" | ||
down_revision = "91e7e3f437a0" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.drop_column("test_execution", "review_decision") | ||
op.drop_column("test_execution", "review_comment") | ||
op.execute("DROP TYPE testexecutionreviewdecision") | ||
|
||
|
||
def downgrade() -> None: | ||
te_review_decision = sa.Enum( | ||
"REJECTED", | ||
"APPROVED_INCONSISTENT_TEST", | ||
"APPROVED_UNSTABLE_PHYSICAL_INFRA", | ||
"APPROVED_FAULTY_HARDWARE", | ||
"APPROVED_CUSTOMER_PREREQUISITE_FAIL", | ||
"APPROVED_ALL_TESTS_PASS", | ||
name="testexecutionreviewdecision", | ||
) | ||
te_review_decision.create(op.get_bind()) | ||
op.add_column( | ||
"test_execution", | ||
sa.Column( | ||
"review_comment", | ||
sa.VARCHAR(), | ||
server_default=sa.text("''::character varying"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
) | ||
op.add_column( | ||
"test_execution", | ||
sa.Column( | ||
"review_decision", | ||
postgresql.ARRAY(te_review_decision), | ||
server_default=sa.text("'{}'::testexecutionreviewdecision[]"), | ||
autoincrement=False, | ||
nullable=False, | ||
), | ||
) |
53 changes: 53 additions & 0 deletions
53
...end/migrations/versions/2024_10_21_1035-063e32aac8db_allow_multiple_testexecution_runs.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"""Allow multiple TestExecution runs | ||
|
||
Revision ID: 063e32aac8db | ||
Revises: b234def463ad | ||
Create Date: 2024-10-21 10:35:17.364462+00:00 | ||
|
||
""" | ||
from textwrap import dedent | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "063e32aac8db" | ||
down_revision = "b234def463ad" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.drop_constraint( | ||
"test_execution_artefact_build_id_environment_id_key", | ||
"test_execution", | ||
type_="unique", | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
remove_test_execution_runs_keeping_latest() | ||
|
||
op.create_unique_constraint( | ||
"test_execution_artefact_build_id_environment_id_key", | ||
"test_execution", | ||
["artefact_build_id", "environment_id"], | ||
) | ||
|
||
|
||
def remove_test_execution_runs_keeping_latest(): | ||
connection = op.get_bind() | ||
|
||
stmt = """\ | ||
SELECT artefact_build_id, environment_id, MAX(id), COUNT(*) | ||
FROM test_execution | ||
GROUP BY artefact_build_id, environment_id | ||
HAVING COUNT(*) > 1 | ||
""" | ||
|
||
for ab_id, e_id, max_id, _ in connection.execute(sa.text(dedent(stmt))): | ||
stmt = f"""\ | ||
DELETE FROM test_execution | ||
WHERE artefact_build_id={ab_id} AND environment_id={e_id} AND id <> {max_id} | ||
""" | ||
op.execute(dedent(stmt)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope everything goes well and we don't have to execute this deletion 😄
But should we perhaps at least locally try to execute this downgrade path, just to make sure it will work correctly if we have to execute it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I sure hope we don't have to do that. I've tried it locally and it worked fine at least for what I've tried.