Skip to content

Commit

Permalink
Extend integration tests to run in two regions (#614)
Browse files Browse the repository at this point in the history
* Extend integration tests to run in two regions

* Extend integration tests to run in two regions

* Add more test resources
  • Loading branch information
bobbyiliev authored Jul 30, 2024
1 parent 34701b1 commit 73bd471
Show file tree
Hide file tree
Showing 17 changed files with 752 additions and 25 deletions.
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,33 @@ services:
- 6878:6878
healthcheck: {test: curl -f localhost:6878/api/readyz, interval: 1s, start_period: 35s}

materialized2:
image: materialize/materialized:latest
container_name: materialized2
command:
- '--cluster-replica-sizes={"3xsmall": {"workers": 1, "scale": 1, "credits_per_hour": "1"}, "2xsmall": {"workers": 1, "scale": 1, "credits_per_hour": "1"}, "25cc": {"workers": 1, "scale": 1, "credits_per_hour": "1"}, "50cc": {"workers": 1, "scale": 1, "credits_per_hour": "1"}}'
- --bootstrap-default-cluster-replica-size=3xsmall
- --bootstrap-builtin-system-cluster-replica-size=3xsmall
- --bootstrap-builtin-catalog-server-cluster-replica-size=3xsmall
- --bootstrap-builtin-support-cluster-replica-size=3xsmall
- --bootstrap-builtin-probe-cluster-replica-size=3xsmall
- --availability-zone=test1
- --availability-zone=test2
- --system-parameter-default=max_clusters=100
- --system-parameter-default=max_sources=100
- --system-parameter-default=max_aws_privatelink_connections=10
- --all-features
environment:
MZ_SQL_LISTEN_ADDR: 0.0.0.0:7875
MZ_HTTP_LISTEN_ADDR: 0.0.0.0:7876
MZ_INTERNAL_SQL_LISTEN_ADDR: 0.0.0.0:7877
MZ_INTERNAL_HTTP_LISTEN_ADDR: 0.0.0.0:7878
ports:
- 7875:7875
- 7877:7877
- 7878:7878
healthcheck: {test: curl -f localhost:7878/api/readyz, interval: 1s, start_period: 35s}

materialized_init:
image: postgres
container_name: materialized_init
Expand Down
76 changes: 76 additions & 0 deletions integration/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,35 @@ resource "materialize_cluster" "cluster" {
comment = "cluster comment"
}

# Create in separate region
resource "materialize_cluster" "cluster_us_west" {
name = "cluster"
comment = "cluster comment"
region = "aws/us-west-2"
}

resource "materialize_cluster" "cluster_source" {
name = "cluster_sources"
}

# Create in separate region
resource "materialize_cluster" "cluster_source_us_west" {
name = "cluster_sources"
region = "aws/us-west-2"
}

resource "materialize_cluster" "cluster_sink" {
name = "cluster_sinks"
size = "3xsmall"
}

# Create in separate region
resource "materialize_cluster" "cluster_sink_us_west" {
name = "cluster_sinks"
size = "3xsmall"
region = "aws/us-west-2"
}

resource "materialize_cluster" "cluster_by_name" {
name = "cluster_by_name"
size = "25cc"
Expand All @@ -29,30 +49,75 @@ resource "materialize_cluster" "scheduling_cluster" {
}
}

# Create in separate region
resource "materialize_cluster" "scheduling_cluster_us_west" {
name = "scheduling_cluster"
size = "25cc"
region = "aws/us-west-2"
scheduling {
on_refresh {
enabled = true
hydration_time_estimate = "1 hour"
}
}
}

resource "materialize_cluster" "no_replication" {
name = "no_replication"
size = "25cc"
replication_factor = 0
}

# Create in separate region
resource "materialize_cluster" "no_replication_us_west" {
name = "no_replication"
size = "25cc"
replication_factor = 0
region = "aws/us-west-2"
}

resource "materialize_cluster_grant" "cluster_grant_usage" {
role_name = materialize_role.role_1.name
privilege = "USAGE"
cluster_name = materialize_cluster.cluster.name
}

# Create in separate region
resource "materialize_cluster_grant" "cluster_grant_usage_us_west" {
role_name = materialize_role.role_1_us_west.name
privilege = "USAGE"
cluster_name = materialize_cluster.cluster_us_west.name
region = "aws/us-west-2"
}

resource "materialize_cluster_grant" "cluster_grant_create" {
role_name = materialize_role.role_2.name
privilege = "CREATE"
cluster_name = materialize_cluster.cluster_source.name
}

# Create in separate region
resource "materialize_cluster_grant" "cluster_grant_create_us_west" {
role_name = materialize_role.role_2_us_west.name
privilege = "CREATE"
cluster_name = materialize_cluster.cluster_source_us_west.name
region = "aws/us-west-2"
}

resource "materialize_cluster_grant_default_privilege" "example" {
grantee_name = materialize_role.grantee.name
privilege = "USAGE"
target_role_name = materialize_role.target.name
}

# Create in separate region
resource "materialize_cluster_grant_default_privilege" "example_us_west" {
grantee_name = materialize_role.grantee_us_west.name
privilege = "USAGE"
target_role_name = materialize_role.target_us_west.name
region = "aws/us-west-2"
}

resource "materialize_cluster" "managed_cluster" {
name = "managed_cluster"
replication_factor = 2
Expand All @@ -62,6 +127,17 @@ resource "materialize_cluster" "managed_cluster" {
disk = true
}

# Create in separate region
resource "materialize_cluster" "managed_cluster_us_west" {
name = "managed_cluster"
replication_factor = 2
size = "25cc"
introspection_interval = "1s"
introspection_debugging = true
disk = true
region = "aws/us-west-2"
}

data "materialize_cluster" "all" {}

data "materialize_current_cluster" "quickstart" {}
40 changes: 40 additions & 0 deletions integration/connection.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ resource "materialize_connection_kafka" "kafka_connection" {
validate = true
}

# Create in separate region
resource "materialize_connection_kafka" "kafka_connection_us_west" {
name = "kafka_connection"
comment = "connection kafka comment"
security_protocol = "PLAINTEXT"

kafka_broker {
broker = "redpanda:9092"
}
region = "aws/us-west-2"
validate = true
}

resource "materialize_connection_kafka" "kafka_conn_ssl_auth" {
name = "kafka_conn_ssl_auth"
security_protocol = "SSL"
Expand All @@ -34,6 +47,33 @@ resource "materialize_connection_kafka" "kafka_conn_ssl_auth" {
validate = false
}

# Create in separate region
resource "materialize_connection_kafka" "kafka_conn_ssl_auth_us_west" {
name = "kafka_conn_ssl_auth"
security_protocol = "SSL"

kafka_broker {
broker = "redpanda:9092"
}

ssl_certificate {
text = "certificate-content"
}

ssl_key {
name = materialize_secret.kafka_password_us_west.name
database_name = materialize_secret.kafka_password_us_west.database_name
schema_name = materialize_secret.kafka_password_us_west.schema_name
}

ssl_certificate_authority {
text = "ca-content"
}

region = "aws/us-west-2"
validate = false
}

resource "materialize_connection_kafka" "kafka_ssh_tunnel_connection" {
name = "kafka_ssh_tunnel_connection"
security_protocol = "PLAINTEXT"
Expand Down
31 changes: 31 additions & 0 deletions integration/database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,55 @@ resource "materialize_database" "database" {
comment = "database comment"
}

# Create in separate region
resource "materialize_database" "database_us_west" {
name = "example_database"
comment = "database comment"
region = "aws/us-west-2"
}

resource "materialize_database_grant" "database_grant_usage" {
role_name = materialize_role.role_1.name
privilege = "USAGE"
database_name = materialize_database.database.name
}

# Create in separate region
resource "materialize_database_grant" "database_grant_usage_us_west" {
role_name = materialize_role.role_1.name
privilege = "USAGE"
database_name = materialize_database.database.name
region = "aws/us-west-2"
}

resource "materialize_database_grant" "database_grant_create" {
role_name = materialize_role.role_2.name
privilege = "CREATE"
database_name = materialize_database.database.name
}

# Create in separate region
resource "materialize_database_grant" "database_grant_create_us_west" {
role_name = materialize_role.role_2_us_west.name
privilege = "CREATE"
database_name = materialize_database.database_us_west.name
region = "aws/us-west-2"
}

resource "materialize_database_grant_default_privilege" "example" {
grantee_name = materialize_role.grantee.name
privilege = "USAGE"
target_role_name = materialize_role.target.name
}

# Create in separate region
resource "materialize_database_grant_default_privilege" "example_us_west" {
grantee_name = materialize_role.grantee_us_west.name
privilege = "USAGE"
target_role_name = materialize_role.target_us_west.name
region = "aws/us-west-2"
}

data "materialize_database" "all" {}

data "materialize_current_database" "default" {}
5 changes: 5 additions & 0 deletions integration/datasources.tf
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
data "materialize_egress_ips" "all" {}

# Get the egress IPs from a specific region
data "materialize_egress_ips" "us_west" {
region = "aws/us-west-2"
}
19 changes: 19 additions & 0 deletions integration/index.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ resource "materialize_index" "loadgen_index" {
}
}

# Create in separate region
resource "materialize_index" "loadgen_index_us_west" {
name = "loadgen_index"
comment = "index comment"
region = "aws/us-west-2"

cluster_name = materialize_cluster.cluster_source_us_west.name

obj_name {
name = materialize_source_load_generator.load_generator_cluster_us_west.name
schema_name = materialize_source_load_generator.load_generator_cluster_us_west.schema_name
database_name = materialize_source_load_generator.load_generator_cluster_us_west.database_name
}

col_expr {
field = "counter"
}
}

resource "materialize_index" "materialized_view_index" {
name = "simple"
cluster_name = "quickstart"
Expand Down
15 changes: 15 additions & 0 deletions integration/materialized_view.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ SELECT
SQL
}

# Create in separate region
resource "materialize_materialized_view" "simple_materialized_view_us_west" {
name = "simple_materialized_view"
schema_name = materialize_schema.schema_us_west.name
database_name = materialize_database.database_us_west.name
comment = "materialize view comment"
cluster_name = "quickstart"
region = "aws/us-west-2"

statement = <<SQL
SELECT
1 AS id
SQL
}

resource "materialize_materialized_view" "materialized_view_assertions" {
name = "materialized_view_assertions"
schema_name = materialize_schema.schema.name
Expand Down
19 changes: 19 additions & 0 deletions integration/rbac.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,34 @@ resource "materialize_database" "db1" {
name = "db1"
}

# Create in separate region
resource "materialize_database" "db1_us_west" {
name = "db1"
region = "aws/us-west-2"
}

resource "materialize_database" "db2" {
name = "db2"
}

# Create in separate region
resource "materialize_database" "db2_us_west" {
name = "db2"
region = "aws/us-west-2"
}

resource "materialize_schema" "schema1" {
name = "schema1"
database_name = materialize_database.db1.name
}

# Create in separate region
resource "materialize_schema" "schema1_us_west" {
name = "schema1"
database_name = materialize_database.db1_us_west.name
region = "aws/us-west-2"
}

resource "materialize_schema" "schema2" {
name = "schema2"
database_name = materialize_database.db1.name
Expand Down
Loading

0 comments on commit 73bd471

Please sign in to comment.