Skip to content

Commit b7250c1

Browse files
authored
integration: test for DisableAuthz2Orders. (letsencrypt#4390)
To make this work, I changed the twenty_days_ago setup to use `config-next` when the main test phase is running `config`. That, in turn, made the recheck_caa test fail, so I added a tweak to that. I also moved the authzv2 migrations into `db`. Without that change, the integration test would fail during the twenty_days_ago setup because Boulder would attempt to create authzv2 objects but the table wouldn't exist yet.
1 parent 62db2d0 commit b7250c1

File tree

6 files changed

+40
-0
lines changed

6 files changed

+40
-0
lines changed
File renamed without changes.

sa/_db-next/migrations/20190524120239_AddAuthz2ExpiresIndex.sql renamed to sa/_db/migrations/20190524120239_AddAuthz2ExpiresIndex.sql

File renamed without changes.

test/config/sa.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
]
2525
},
2626
"features": {
27+
"DisableAuthz2Orders": true,
2728
"DeleteUnusedChallenges": true
2829
}
2930
},

test/integration-test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ def main():
244244
config = default_config_dir
245245
if CONFIG_NEXT:
246246
config = "test/config"
247+
else:
248+
config = "test/config-next"
247249
now = datetime.datetime.utcnow()
248250

249251
six_months_ago = now+datetime.timedelta(days=-30*6)

test/v1_integration.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,13 @@ def test_recheck_caa():
449449
was good. We'll set a new CAA record forbidding issuance; the CAA should
450450
recheck CAA and reject the request.
451451
"""
452+
# TODO(jsha): We can't do this test in non-CONFIG_NEXT mode
453+
# because of authzv2. We do the twenty_days setup in CONFIG_NEXT
454+
# mode (creating an authzv2), then restart Boulder with the authzv2
455+
# flag disabled, which causes the authz to 404. Remove this check once
456+
# authzv2 is live.
457+
if not CONFIG_NEXT:
458+
return
452459
if len(caa_recheck_authzs) == 0:
453460
raise Exception("CAA authzs not prepared for test_caa")
454461
domains = []

test/v2_integration.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,36 @@ def test_z1_reuse():
936936
if len(authz_uris) != 0:
937937
raise Exception("Failed to reuse all authzs. Remaining: %s" % authz_uris)
938938

939+
z2_disable_client = None
940+
z2_disable_authz = None
941+
z2_disable_order = None
942+
@register_twenty_days_ago
943+
def z2_disable_setup():
944+
global z2_disable_client
945+
global z2_disable_authz
946+
global z2_disable_order
947+
z2_disable_client = chisel2.make_client()
948+
z2_disable_order = chisel2.auth_and_issue([random_domain()])
949+
z2_disable_authz = z2_disable_order.authorizations[0]
950+
951+
def test_z2_disable():
952+
"""Test the DisableAuthz2Orders feature flag. Only runs when
953+
that flag is set (that is, not in CONFIG_NEXT mode)."""
954+
if CONFIG_NEXT:
955+
return
956+
response = requests.get(z2_disable_authz.uri)
957+
if response.status_code != 404:
958+
raise Exception("Expected authorization to be disabled. Got %s" %
959+
response)
960+
response = requests.get(z2_disable_order.uri)
961+
if response.status_code != 404:
962+
raise Exception("Expected order to be disabled. Got %s" %
963+
response)
964+
o = z2_disable_client.new_order(
965+
chisel2.make_csr([z2_disable_authz.body.identifier.value]))
966+
if o.authorizations[0].uri == z2_disable_authz.uri:
967+
raise Exception("Expected authzv2 authorization not to be reused")
968+
939969
def test_new_order_policy_errs():
940970
"""
941971
Test that creating an order with policy blocked identifiers returns

0 commit comments

Comments
 (0)