Skip to content

Commit

Permalink
test: fix hangs on cdk
Browse files Browse the repository at this point in the history
  • Loading branch information
fraidev committed Nov 22, 2024
1 parent b288163 commit 96e8c2e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
44 changes: 22 additions & 22 deletions tests/cli/cdk_smoke_tests/cdk-basic.bats
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ setup_file() {
# Test
cd $CONNECTOR_DIR
run $CDK_BIN test --target x86_64-unknown-linux-gnu \
$CONFIG_FILE_FLAG
$CONFIG_FILE_FLAG 3>&-
assert_success

assert_output --partial "Connector runs with process id"
Expand All @@ -39,7 +39,7 @@ setup_file() {
# Test
cd $CONNECTOR_DIR
run $CDK_BIN test --target x86_64-unknown-linux-gnu \
$CONFIG_FILE_FLAG_V2
$CONFIG_FILE_FLAG_V2 3>&-
assert_success

assert_output --partial "Connector runs with process id"
Expand All @@ -50,13 +50,13 @@ setup_file() {
@test "Build and deploy connector" {
# Build
cd $CONNECTOR_DIR
run $CDK_BIN build --target x86_64-unknown-linux-gnu
run $CDK_BIN build --target x86_64-unknown-linux-gnu 3>&-
assert_success

# Deploy
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start \
$CONFIG_FILE_FLAG
$CONFIG_FILE_FLAG 3>&-
assert_success

assert_output --partial "Connector runs with process id"
Expand All @@ -67,20 +67,20 @@ setup_file() {
assert_output --partial "producing a value"
assert_success

run $CDK_BIN deploy shutdown --name my-json-test-connector
run $CDK_BIN deploy shutdown --name my-json-test-connector 3>&-
assert_success
}

@test "Build and deploy connector V2" {
# Build
cd $CONNECTOR_DIR
run $CDK_BIN build --target x86_64-unknown-linux-gnu
run $CDK_BIN build --target x86_64-unknown-linux-gnu 3>&-
assert_success

# Deploy
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start \
$CONFIG_FILE_FLAG_V2
$CONFIG_FILE_FLAG_V2 3>&-
assert_success

assert_output --partial "Connector runs with process id"
Expand All @@ -91,19 +91,19 @@ setup_file() {
assert_output --partial "producing a value"
assert_success

run $CDK_BIN deploy shutdown --name my-json-test-connector
run $CDK_BIN deploy shutdown --name my-json-test-connector 3>&-
assert_success
}

@test "Pack connector" {
# Pack when package meta doesn't exist
cd $CONNECTOR_DIR
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu 3>&-
assert_success

# Pack when package meta exists
cd $CONNECTOR_DIR
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu 3>&-
assert_success
}

Expand All @@ -115,7 +115,7 @@ setup_file() {
mkdir ../testing
echo "# Testing Connector Readme" > ../testing/README.md

run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu --readme ../testing/README.md
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu --readme ../testing/README.md 3>&-
assert_success

# Ensure the correct path is added
Expand All @@ -129,7 +129,7 @@ setup_file() {
@test "Run connector with --ipkg" {
# create package meta doesn't exist
cd $CONNECTOR_DIR
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu 3>&-
assert_success

IPKG_DIR=$TEST_DIR/ipkg
Expand All @@ -140,18 +140,18 @@ setup_file() {

cd $IPKG_DIR

run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config.yaml
run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config.yaml 3>&-
assert_success
assert_output --partial "Connector runs with process id"

run $CDK_BIN deploy shutdown --name my-json-test-connector
run $CDK_BIN deploy shutdown --name my-json-test-connector 3>&-
assert_success
}

@test "Run connector with --ipkg V2" {
# create package meta doesn't exist
cd $CONNECTOR_DIR
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu 3>&-
assert_success

IPKG_DIR=$TEST_DIR/ipkg_v2
Expand All @@ -162,11 +162,11 @@ setup_file() {

cd $IPKG_DIR

run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config-v2.yaml
run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config-v2.yaml 3>&-
assert_success
assert_output --partial "Connector runs with process id"

run $CDK_BIN deploy shutdown --name my-json-test-connector
run $CDK_BIN deploy shutdown --name my-json-test-connector 3>&-
assert_success
}

Expand All @@ -181,14 +181,14 @@ setup_file() {
--group "$PROJECT_NAME_PREFIX" \
--conn-description "My Sink Connector" \
--conn-type sink \
--conn-public true
--conn-public true 3>&-
assert_success

# cd into the sink connector directory
cd $SINK_CONN_NAME

# build connector
run $CDK_BIN build --target x86_64-unknown-linux-gnu
run $CDK_BIN build --target x86_64-unknown-linux-gnu 3>&-
assert_success
}

Expand All @@ -203,14 +203,14 @@ setup_file() {
--group "$PROJECT_NAME_PREFIX" \
--conn-description "My Source Connector" \
--conn-type source \
--conn-public true
--conn-public true 3>&-
assert_success

# cd into the source connector directory
cd $SOURCE_CONN_NAME

# build connector
run $CDK_BIN build --target x86_64-unknown-linux-gnu
run $CDK_BIN build --target x86_64-unknown-linux-gnu 3>&-
assert_success
}

Expand All @@ -225,7 +225,7 @@ setup_file() {
--group "$PROJECT_NAME_PREFIX" \
--conn-description "My Source Connector" \
--conn-type bad-type \
--conn-public true
--conn-public true 3>&-
assert_failure
}

Expand Down
20 changes: 10 additions & 10 deletions tests/cli/cdk_smoke_tests/cdk-multi-deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ setup_file() {
@test "Build and deploy multiple connectors" {
# Build
cd $CONNECTOR_DIR
run $CDK_BIN build --target x86_64-unknown-linux-gnu
run $CDK_BIN build --target x86_64-unknown-linux-gnu 3>&-
assert_success

# Deploy
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start \
$CONFIG_FILE_FLAG_V2
$CONFIG_FILE_FLAG_V2 3>&-
assert_success

assert_output --partial "Connector runs with process id"

# Deploy the same config, with a different connector name
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start \
$CONFIG2_FILE_FLAG_V2
$CONFIG2_FILE_FLAG_V2 3>&-
assert_success
assert_output --partial "Connector runs with process id"
sleep 10
Expand All @@ -54,17 +54,17 @@ setup_file() {
assert_output --partial "producing a value"
assert_success

run $CDK_BIN deploy shutdown --name my-json-test-connector
run $CDK_BIN deploy shutdown --name my-json-test-connector 3>&-
assert_success

run $CDK_BIN deploy shutdown --name my-json-test-connector2
run $CDK_BIN deploy shutdown --name my-json-test-connector2 3>&-
assert_success
}

@test "Run multiple connectors with --ipkg" {
# create package meta doesn't exist
cd $CONNECTOR_DIR
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu
run $CDK_BIN publish --pack --target x86_64-unknown-linux-gnu 3>&-
assert_success

IPKG_DIR=$TEST_DIR/ipkg_v2
Expand All @@ -76,17 +76,17 @@ setup_file() {

cd $IPKG_DIR

run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config-v2.yaml
run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config-v2.yaml 3>&-
assert_success
assert_output --partial "Connector runs with process id"

run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config2-v2.yaml
run $CDK_BIN deploy start --ipkg json-test-connector-0.1.0.ipkg --config sample-config2-v2.yaml 3>&-
assert_success
assert_output --partial "Connector runs with process id"

run $CDK_BIN deploy shutdown --name my-json-test-connector
run $CDK_BIN deploy shutdown --name my-json-test-connector 3>&-
assert_success

run $CDK_BIN deploy shutdown --name my-json-test-connector2
run $CDK_BIN deploy shutdown --name my-json-test-connector2 3>&-
assert_success
}
16 changes: 8 additions & 8 deletions tests/cli/cdk_smoke_tests/cdk-multi-partition-consumer.bats
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ custom:
EOF
# Test
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info 3>&-
assert_success
assert_output --partial "Connector runs with process id"

Expand All @@ -66,7 +66,7 @@ EOF

refute_output --partial 'Received record: 1'

run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME
run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME 3>&-
assert_success
}

Expand Down Expand Up @@ -102,7 +102,7 @@ custom:
EOF
# Test
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info 3>&-
assert_success
assert_output --partial "Connector runs with process id"

Expand All @@ -115,7 +115,7 @@ EOF
wait_for_line_in_file "Received record: 4" $LOG_PATH 30
wait_for_line_in_file "Received record: 1" $LOG_PATH 2

run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME
run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME 3>&-
assert_success
}

Expand Down Expand Up @@ -153,7 +153,7 @@ custom:
EOF
# Test
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info 3>&-
assert_success
assert_output --partial "Connector runs with process id"

Expand All @@ -170,7 +170,7 @@ EOF
run cat $LOG_PATH
refute_output --partial 'Received record: 3'

run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME
run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME 3>&-
assert_success
}

Expand Down Expand Up @@ -225,7 +225,7 @@ custom:
EOF
# Test
cd $CONNECTOR_DIR
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info
run $CDK_BIN deploy --target x86_64-unknown-linux-gnu start --config $CONFIG_PATH --log-level info 3>&-
assert_success
assert_output --partial "Connector runs with process id"

Expand All @@ -243,6 +243,6 @@ EOF
OFFSET=$("$FLUVIO_BIN" consumer list -O json | jq ".[] | select(.consumer_id == \"$CONSUMER_NAME\") | .offset")
assert [ ! -z $OFFSET ]

run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME
run $CDK_BIN deploy shutdown --name $CONNECTOR_NAME 3>&-
assert_success
}

0 comments on commit 96e8c2e

Please sign in to comment.