Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markdboyd committed Sep 10, 2024
1 parent aa5edd5 commit 4c083b7
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions tests/integration/alb/test_alb_renewals.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
subtest_update_creates_private_key_and_csr,
)
from tests.lib.alb.update import (
subtest_removes_certificate_from_alb,
subtest_removes_previous_certificate_from_alb,
)
from tests.lib.factories import (
ALBServiceInstanceFactory,
Expand Down Expand Up @@ -140,7 +140,7 @@ def test_scan_for_expiring_certs_alb_happy_path(
subtest_provision_adds_certificate_to_alb(tasks, alb)
subtest_provision_provisions_ALIAS_records(tasks, route53, instance_model)
subtest_provision_waits_for_route53_changes(tasks, route53, instance_model)
subtest_removes_certificate_from_alb(
subtest_removes_previous_certificate_from_alb(
tasks, alb, "listener-arn-0", "certificate_arn"
)
subtest_renewal_removes_certificate_from_iam(tasks, iam_govcloud)
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/alb/test_alb_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from tests.lib.alb.update import (
subtest_update_uploads_new_cert,
subtest_update_provisions_ALIAS_records,
subtest_removes_certificate_from_alb,
subtest_removes_previous_certificate_from_alb,
)


Expand All @@ -41,7 +41,7 @@ def subtest_update_happy_path(
subtest_update_adds_certificate_to_alb(tasks, alb, instance_model)
subtest_update_provisions_ALIAS_records(tasks, route53, instance_model)
subtest_waits_for_dns_changes(tasks, route53, instance_model)
subtest_removes_certificate_from_alb(
subtest_removes_previous_certificate_from_alb(
tasks,
alb,
"listener-arn-0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
subtest_provision_retrieves_certificate,
)
from tests.lib.alb.update import (
subtest_removes_certificate_from_alb,
subtest_removes_previous_certificate_from_alb,
)
from tests.lib.update import (
subtest_update_creates_private_key_and_csr,
Expand Down Expand Up @@ -146,7 +146,9 @@ def test_scan_for_expiring_certs_alb_happy_path(
subtest_provision_adds_certificate_to_alb(tasks, alb)
subtest_provision_provisions_ALIAS_records(tasks, route53, instance_model)
subtest_provision_waits_for_route53_changes(tasks, route53, instance_model)
subtest_removes_certificate_from_alb(tasks, alb, "our-arn-0", "certificate_arn")
subtest_removes_previous_certificate_from_alb(
tasks, alb, "our-arn-0", "certificate_arn"
)
subtest_renewal_removes_certificate_from_iam(tasks, iam_govcloud)
subtest_provision_marks_operation_as_succeeded(tasks, instance_model)

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/dedicated_alb/test_dedicated_alb_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from tests.lib.alb.update import (
subtest_update_uploads_new_cert,
subtest_update_provisions_ALIAS_records,
subtest_removes_certificate_from_alb,
subtest_removes_previous_certificate_from_alb,
)


Expand All @@ -45,7 +45,7 @@ def subtest_update_happy_path(
subtest_update_adds_certificate_to_alb(tasks, alb)
subtest_update_provisions_ALIAS_records(tasks, route53, instance_model)
subtest_waits_for_dns_changes(tasks, route53, instance_model)
subtest_removes_certificate_from_alb(
subtest_removes_previous_certificate_from_alb(
tasks,
alb,
"our-arn-0",
Expand Down
14 changes: 10 additions & 4 deletions tests/integration/plan_updates/test_alb_update_to_dedicated_alb.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)
from tests.lib.alb.provision import subtest_provision_provisions_ALIAS_records
from tests.lib.alb.update import (
subtest_removes_certificate_from_alb,
subtest_removes_previous_certificate_from_alb,
)


Expand Down Expand Up @@ -85,11 +85,17 @@ def test_update_alb_to_dedicated_alb_happy_path(
instance_model = DedicatedALBServiceInstance
subtest_provision_provisions_ALIAS_records(tasks, route53, instance_model)
subtest_provision_waits_for_route53_changes(tasks, route53, instance_model)
subtest_removes_certificate_from_alb(
tasks, alb, "alb-listener-arn-1", "certificate_arn"
)
subtest_renewal_removes_certificate_from_alb(tasks, alb)
clean_db.session.expunge_all()
instance = clean_db.session.get(DedicatedALBServiceInstance, "4321")
assert instance.new_certificate is None
assert instance.current_certificate is not None
subtest_provision_marks_operation_as_succeeded(tasks, instance_model)


def subtest_renewal_removes_certificate_from_alb(tasks, alb):
alb.expect_remove_certificate_from_listener("alb-listener-arn-1", "certificate_arn")

tasks.run_queued_tasks_and_enqueue_dependents()

alb.assert_no_pending_responses()
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
subtest_renewal_removes_certificate_from_iam,
)
from tests.lib.alb.update import (
subtest_removes_certificate_from_alb,
subtest_removes_previous_certificate_from_alb,
)

from broker.models import ALBServiceInstance
Expand Down Expand Up @@ -134,7 +134,7 @@ def test_migration_pipeline(
subtest_provision_adds_certificate_to_alb(tasks, alb)
subtest_provision_provisions_ALIAS_records(tasks, route53, instance_model)
subtest_provision_waits_for_route53_changes(tasks, route53, instance_model)
subtest_removes_certificate_from_alb(
subtest_removes_previous_certificate_from_alb(
tasks, alb, "listener-arn-0", "certificate_arn"
)
subtest_renewal_removes_certificate_from_iam(tasks, iam_govcloud)
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
create_new_health_checks,
delete_unused_health_checks,
delete_health_checks,
_create_health_checks,
)
from broker.models import CDNDedicatedWAFServiceInstance, Operation

Expand Down
4 changes: 3 additions & 1 deletion tests/lib/alb/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def subtest_update_noop(client, instance_model):
assert client.response.status_code == 200


def subtest_removes_certificate_from_alb(tasks, alb, listener_arn, certificate_arn):
def subtest_removes_previous_certificate_from_alb(
tasks, alb, listener_arn, certificate_arn
):
alb.expect_remove_certificate_from_listener(
listener_arn,
certificate_arn,
Expand Down

0 comments on commit 4c083b7

Please sign in to comment.