-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Extract TestExecutionStarter class from start_test_execution controller * Move dependencies to controller class * Extract methods of TestExecutionController for readability * Remove weird try catch * Remove unused import * Store revision for charms too * Simplify create artefact function * Validate stage name on start test request * Add image family * Add image artefact fields * Add functionality to store artefact image specific fields * Make start image test more thorough * Add some todos * Use multiple parameter Literal * Fix some linting issues * Add image_url to Artefact * CExtract assertion logic * Test start test for all families * Create TestStartTest class to test all families together * Move test_requires_family_field into TestStartTest * Add tests for required fields of image and charm start test * Add test for reuse of objects on test start * Update artefact uniqueness * Move all family independent start tests into common class * Support getting image artefacts * Add logic to get previous test results for images * Fix artefact versions for images * Remove test requiring ci_link * Add some image artefacts to seed script * Fix tests
- Loading branch information
Showing
23 changed files
with
826 additions
and
480 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
100 changes: 100 additions & 0 deletions
100
backend/migrations/versions/2025_01_08_1312-121edad6b53f_add_image_family.py
This file contains 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,100 @@ | ||
"""Add image family | ||
Revision ID: 121edad6b53f | ||
Revises: 7878a1b29384 | ||
Create Date: 2025-01-08 13:12:05.831020+00:00 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "121edad6b53f" | ||
down_revision = "7878a1b29384" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
add_image_family() | ||
add_new_stages() | ||
|
||
add_os_column() | ||
add_release_column() | ||
add_sha256_column() | ||
add_owner_column() | ||
add_image_url_column() | ||
|
||
|
||
def add_image_family(): | ||
op.execute("ALTER TYPE familyname ADD VALUE IF NOT EXISTS 'image'") | ||
|
||
|
||
def add_new_stages(): | ||
op.execute("ALTER TYPE stagename ADD VALUE IF NOT EXISTS 'pending'") | ||
op.execute("ALTER TYPE stagename ADD VALUE IF NOT EXISTS 'current'") | ||
|
||
|
||
def add_os_column(): | ||
op.add_column("artefact", sa.Column("os", sa.String(length=200))) | ||
op.execute("UPDATE artefact SET os = '' WHERE os is NULL") | ||
op.alter_column("artefact", "os", nullable=False) | ||
|
||
|
||
def add_release_column(): | ||
op.add_column("artefact", sa.Column("release", sa.String(length=200))) | ||
op.execute("UPDATE artefact SET release = '' WHERE release is NULL") | ||
op.alter_column("artefact", "release", nullable=False) | ||
|
||
|
||
def add_sha256_column(): | ||
op.add_column("artefact", sa.Column("sha256", sa.String(length=200))) | ||
op.execute("UPDATE artefact SET sha256 = '' WHERE sha256 is NULL") | ||
op.alter_column("artefact", "sha256", nullable=False) | ||
|
||
|
||
def add_owner_column(): | ||
op.add_column("artefact", sa.Column("owner", sa.String(length=200))) | ||
op.execute("UPDATE artefact SET owner = '' WHERE owner is NULL") | ||
op.alter_column("artefact", "owner", nullable=False) | ||
|
||
|
||
def add_image_url_column(): | ||
op.add_column("artefact", sa.Column("image_url", sa.String(length=200))) | ||
op.execute("UPDATE artefact SET image_url = '' WHERE image_url is NULL") | ||
op.alter_column("artefact", "image_url", nullable=False) | ||
|
||
|
||
def downgrade() -> None: | ||
op.execute("DELETE FROM artefact WHERE family = 'image'") | ||
op.drop_column("artefact", "owner") | ||
op.drop_column("artefact", "sha256") | ||
op.drop_column("artefact", "release") | ||
op.drop_column("artefact", "os") | ||
op.drop_column("artefact", "image_url") | ||
|
||
remove_image_family_enum_value() | ||
remove_added_stage_enum_values() | ||
|
||
|
||
def remove_image_family_enum_value(): | ||
op.execute("ALTER TYPE familyname RENAME TO familyname_old") | ||
op.execute("CREATE TYPE familyname AS " "ENUM('snap', 'deb', 'charm')") | ||
op.execute( | ||
"ALTER TABLE artefact ALTER COLUMN family TYPE " | ||
"familyname USING family::text::familyname" | ||
) | ||
op.execute("DROP TYPE familyname_old") | ||
|
||
|
||
def remove_added_stage_enum_values(): | ||
op.execute("ALTER TYPE stagename RENAME TO stagename_old") | ||
op.execute( | ||
"CREATE TYPE stagename AS " | ||
"ENUM('edge', 'beta', 'candidate', 'stable', 'proposed', 'updates')" | ||
) | ||
op.execute( | ||
"ALTER TABLE artefact ALTER COLUMN stage TYPE " | ||
"stagename USING stage::text::stagename" | ||
) | ||
op.execute("DROP TYPE stagename_old") |
73 changes: 73 additions & 0 deletions
73
...end/migrations/versions/2025_01_14_0934-2be627e68efd_update_artefact_unique_constraint.py
This file contains 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,73 @@ | ||
"""Update artefact unique constraint | ||
Revision ID: 2be627e68efd | ||
Revises: 121edad6b53f | ||
Create Date: 2025-01-14 09:34:28.190863+00:00 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "2be627e68efd" | ||
down_revision = "121edad6b53f" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_index( | ||
"unique_charm", | ||
"artefact", | ||
["name", "version", "track"], | ||
unique=True, | ||
postgresql_where=sa.text("family = 'charm'"), | ||
) | ||
op.create_index( | ||
"unique_image", | ||
"artefact", | ||
["sha256"], | ||
unique=True, | ||
postgresql_where=sa.text("family = 'image'"), | ||
) | ||
|
||
op.drop_index("unique_snap", "artefact") | ||
op.create_index( | ||
"unique_snap", | ||
"artefact", | ||
["name", "version", "track"], | ||
unique=True, | ||
postgresql_where=sa.text("family = 'snap'"), | ||
) | ||
|
||
op.drop_index("unique_deb", "artefact") | ||
op.create_index( | ||
"unique_deb", | ||
"artefact", | ||
["name", "version", "series", "repo"], | ||
unique=True, | ||
postgresql_where=sa.text("family = 'deb'"), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index("unique_deb", "artefact") | ||
op.create_index( | ||
"unique_deb", | ||
"artefact", | ||
["name", "version", "series", "repo"], | ||
unique=True, | ||
postgresql_where=sa.text("series != '' AND repo != ''"), | ||
) | ||
|
||
op.drop_index("unique_snap", "artefact") | ||
op.create_index( | ||
"unique_snap", | ||
"artefact", | ||
["name", "version", "track"], | ||
unique=True, | ||
postgresql_where=sa.text("track != ''"), | ||
) | ||
|
||
op.drop_index("unique_image", table_name="artefact") | ||
op.drop_index("unique_charm", table_name="artefact") |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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.