-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
157 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Compared with prior source tests (`e2e_test/source`), tests in this directory are expected to be easy to run locally and easy to write. | ||
|
||
To run locally, use `risdev d` to start services (including external systems like Kafka and Postgres). | ||
Then use `risedev slt` to run the tests, which will load the environment variables (ports, etc.) | ||
according to the services started by `risdev d`. | ||
|
||
```sh | ||
risedev slt 'e2e_test/source-new/**/*.slt' | ||
``` | ||
|
||
To write tests, please ensure each file is self-contained and does not depend on external scripts to setup the environment. | ||
Use `system` command to setup instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# This file contains commands used by the tests. | ||
|
||
[tasks.source-test-hook] | ||
private = true | ||
dependencies = ["check-risedev-env-file"] | ||
env_files = ["${PREFIX_CONFIG}/risedev-env"] | ||
|
||
[tasks.check-kafka-env] | ||
dependencies = ["check-risedev-env-file"] | ||
env_files = ["${PREFIX_CONFIG}/risedev-env"] | ||
script = ''' | ||
#!/usr/bin/env bash | ||
set -e | ||
if [ ! -d "${PREFIX_BIN}/kafka" ]; then | ||
echo "Kafka is not installed in ${PREFIX_BIN}/kafka. Did you enable Kafka using $(tput setaf 4)\`./risedev configure\`$(tput sgr0)?" | ||
exit 1 | ||
fi | ||
# TODO: we may support risedev-env.override so that we can connect to a Kafka not started by risedev-dev. | ||
if [ -z "${RISEDEV_KAFKA_BOOTSTRAP_SERVERS}" ]; then | ||
echo "RISEDEV_KAFKA_BOOTSTRAP_SERVERS is not set in risedev-env file. Did you start Kafka using $(tput setaf 4)\`./risedev d\`$(tput sgr0)?" | ||
exit 1 | ||
fi | ||
''' | ||
|
||
[tasks.kafka-topics] | ||
category = "RiseDev - Test - Source Test - Kafka" | ||
description = "This tool helps to create, delete, describe, or change a topic. " | ||
dependencies = ["check-kafka-env"] | ||
script = """ | ||
#!/usr/bin/env bash | ||
set -e | ||
${PREFIX_BIN}/kafka/bin/kafka-topics.sh --bootstrap-server ${RISEDEV_KAFKA_BOOTSTRAP_SERVERS} "$@" | ||
""" | ||
|
||
[tasks.kafka-produce] | ||
category = "RiseDev - Test - Source Test - Kafka" | ||
description = "This tool helps to read data from standard input and publish it to Kafka." | ||
dependencies = ["check-kafka-env"] | ||
script = """ | ||
#!/usr/bin/env bash | ||
set -e | ||
${PREFIX_BIN}/kafka/bin/kafka-console-producer.sh --bootstrap-server ${RISEDEV_KAFKA_BOOTSTRAP_SERVERS} "$@" | ||
""" | ||
|
||
[tasks.kafka-consume] | ||
category = "RiseDev - Test - Source Test - Kafka" | ||
description = "This tool helps to read data from Kafka topics and outputs it to standard output." | ||
dependencies = ["check-kafka-env"] | ||
script = """ | ||
#!/usr/bin/env bash | ||
set -e | ||
${PREFIX_BIN}/kafka/bin/kafka-console-consumer.sh --bootstrap-server ${RISEDEV_KAFKA_BOOTSTRAP_SERVERS} "$@" | ||
""" | ||
|
||
[tasks.kafka-consumer-groups] | ||
category = "RiseDev - Test - Source Test - Kafka" | ||
description = "This tool helps to read data from Kafka topics and outputs it to standard output." | ||
dependencies = ["check-kafka-env"] | ||
script = """ | ||
#!/usr/bin/env bash | ||
set -e | ||
${PREFIX_BIN}/kafka/bin/kafka-consumer-groups.sh --bootstrap-server ${RISEDEV_KAFKA_BOOTSTRAP_SERVERS} "$@" | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
system ok | ||
./risedev kafka-topics --topic source_new_test_1 --create --partitions 3 | ||
|
||
system ok | ||
echo "1" | ./risedev kafka-produce --topic source_new_test_1 | ||
|
||
|
||
system ok | ||
./risedev kafka-topics --topic source_new_test_1 --delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters