(c: Composition, parser: WorkflowArgumentParser)
| 52 | |
| 53 | |
| 54 | def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None: |
| 55 | # Sleeping to wait for IAM to propagate is ugly and somewhat flaky, but |
| 56 | # there isn't an obviously better solution. This only runs in the nightly |
| 57 | # pipeline, so flakes are more tolerable than they would be if this ran in |
| 58 | # the PR pipeline. |
| 59 | parser.add_argument( |
| 60 | "--iam-propagation-seconds", |
| 61 | type=int, |
| 62 | default=10, |
| 63 | help="how long to wait for IAM policies to propagate", |
| 64 | ) |
| 65 | args = parser.parse_args() |
| 66 | |
| 67 | # Set up. |
| 68 | ctx = TestContext(iam_propagation_seconds=args.iam_propagation_seconds) |
| 69 | |
| 70 | # Create the "jump role" that Materialize will use to assume each |
| 71 | # connection's role. |
| 72 | connection_role = f"testdrive-{ctx.seed}-MaterializeConnection" |
| 73 | connection_role_arn = f"arn:aws:iam::{ctx.account_id}:role/{connection_role}" |
| 74 | _create_role(ctx, connection_role, ctx.materialized_principal) |
| 75 | |
| 76 | try: |
| 77 | # Start Materialize. |
| 78 | materialized = Materialized( |
| 79 | environment_extra=[ |
| 80 | "AWS_DEFAULT_REGION=us-east-1", |
| 81 | "AWS_ACCESS_KEY_ID", |
| 82 | "AWS_PROFILE", |
| 83 | "AWS_SECRET_ACCESS_KEY", |
| 84 | "AWS_SESSION_TOKEN", |
| 85 | ], |
| 86 | volumes_extra=[ |
| 87 | # Mounting the .aws directory in the container allows Materialize to |
| 88 | # use SSO credentials, which makes it easier to run this composition |
| 89 | # locally. CI doesn't need this. |
| 90 | "~/.aws:/home/materialize/.aws", |
| 91 | ], |
| 92 | options=[ |
| 93 | f"--aws-connection-role-arn={connection_role_arn}", |
| 94 | f"--aws-external-id-prefix={AWS_EXTERNAL_ID_PREFIX}", |
| 95 | ], |
| 96 | environment_id=AWS_ENVIRONMENT_ID, |
| 97 | ) |
| 98 | with c.override(materialized): |
| 99 | # (Re)start Materialize and enable AWS connections. |
| 100 | c.down() |
| 101 | c.up("materialized") |
| 102 | c.sql( |
| 103 | port=6877, |
| 104 | user="mz_system", |
| 105 | sql=""" |
| 106 | ALTER SYSTEM SET enable_connection_validation_syntax = true; |
| 107 | ALTER SYSTEM SET enable_s3_tables_region_check = true; |
| 108 | """, |
| 109 | ) |
| 110 | |
| 111 | for fn in [ |
nothing calls this directly
no test coverage detected