Skip to content

Commit ea8cdcc

Browse files
committed
Fixing tests
1 parent 40fb10f commit ea8cdcc

File tree

4 files changed

+127
-11
lines changed

4 files changed

+127
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<maven-plugin-exec.version>3.0.0</maven-plugin-exec.version>
3434
<version.maven.plugin.resources>3.3.1</version.maven.plugin.resources>
3535
<version.maven.plugin.failsafe>2.22.2</version.maven.plugin.failsafe>
36-
<version.maven.plugin.surefire>3.0.0</version.maven.plugin.surefire>
36+
<version.maven.plugin.surefire>2.22.2</version.maven.plugin.surefire>
3737
<version.maven.plugin.release>2.5.2</version.maven.plugin.release>
3838
<version.maven.plugin.javadoc>3.4.1</version.maven.plugin.javadoc>
3939
<version.maven.plugin.jar>3.3.0</version.maven.plugin.jar>

src/main/dist/astra-init.sh

Lines changed: 120 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ function _complete_astra_group_db() {
475475
CURR_CMD=${COMP_WORDS[2]}
476476
fi
477477

478-
COMMANDS="list-regions list-clouds download-scb delete-region create-region delete swagger create-keyspace list-cdc list-regions-classic load get unload create playground delete-cdc create-cdc resume list-keyspaces list-regions-serverless count create-dotenv list describe cqlsh status"
478+
COMMANDS="list-regions delete-keyspace list-clouds download-scb delete-region create-region delete swagger create-keyspace list-cdc list-regions-classic load get unload create playground delete-cdc create-cdc resume list-keyspaces list-regions-serverless count create-dotenv list describe cqlsh status"
479479
if [[ ${COMP_CWORD} -eq 2 ]]; then
480480
COMPREPLY=( $(_complete_astra_group_db_command_list "${COMMANDS}" ) )
481481
DEFAULT_GROUP_COMMAND_COMPLETIONS=(${COMPREPLY[@]})
@@ -535,6 +535,11 @@ function _complete_astra_group_db() {
535535
echo ${COMPREPLY[@]}
536536
return $?
537537
;;
538+
delete-keyspace)
539+
COMPREPLY=( $(_complete_astra_group_db_command_deletekeyspace "${COMMANDS}" ) )
540+
echo ${COMPREPLY[@]}
541+
return $?
542+
;;
538543
list-keyspaces)
539544
COMPREPLY=( $(_complete_astra_group_db_command_listkeyspaces "${COMMANDS}" ) )
540545
echo ${COMPREPLY[@]}
@@ -1143,6 +1148,61 @@ function _complete_astra_group_db_command_createkeyspace() {
11431148
return 0
11441149
}
11451150

1151+
function _complete_astra_group_db_command_deletekeyspace() {
1152+
# Get completion data
1153+
COMPREPLY=()
1154+
CURR_WORD=${COMP_WORDS[COMP_CWORD]}
1155+
PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
1156+
COMMANDS=$1
1157+
1158+
FLAG_OPTS="--no-color --async -v --verbose"
1159+
ARG_OPTS="--token -cf --config-file --keyspace -o -conf --timeout -k --config --output"
1160+
1161+
$( containsElement ${PREV_WORD} ${ARG_OPTS[@]} )
1162+
SAW_ARG=$?
1163+
if [[ ${SAW_ARG} -eq 0 ]]; then
1164+
ARG_VALUES=
1165+
ARG_GENERATED_VALUES=
1166+
case ${PREV_WORD} in
1167+
--token)
1168+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1169+
echo ${COMPREPLY[@]}
1170+
return 0
1171+
;;
1172+
-cf|--config-file)
1173+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1174+
echo ${COMPREPLY[@]}
1175+
return 0
1176+
;;
1177+
-k|--keyspace)
1178+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1179+
echo ${COMPREPLY[@]}
1180+
return 0
1181+
;;
1182+
-conf|--config)
1183+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1184+
echo ${COMPREPLY[@]}
1185+
return 0
1186+
;;
1187+
--timeout)
1188+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1189+
echo ${COMPREPLY[@]}
1190+
return 0
1191+
;;
1192+
-o|--output)
1193+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
1194+
echo ${COMPREPLY[@]}
1195+
return 0
1196+
;;
1197+
esac
1198+
fi
1199+
1200+
ARGUMENTS=
1201+
COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${ARGUMENTS}" -- ${CURR_WORD}) )
1202+
echo ${COMPREPLY[@]}
1203+
return 0
1204+
}
1205+
11461206
function _complete_astra_group_db_command_listkeyspaces() {
11471207
# Get completion data
11481208
COMPREPLY=()
@@ -2105,8 +2165,8 @@ function _complete_astra_group_db_command_createcdc() {
21052165
PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
21062166
COMMANDS=$1
21072167

2108-
FLAG_OPTS="--no-color -v --verbose"
2109-
ARG_OPTS="--token -cf --config-file --keyspace -o --tenant -conf -p, --partition --table -k --config --output"
2168+
FLAG_OPTS="--no-color --async -v --verbose"
2169+
ARG_OPTS="--token --config-file --keyspace -o --tenant --timeout --config -cf -conf -p, --partition --table -k --output"
21102170

21112171
$( containsElement ${PREV_WORD} ${ARG_OPTS[@]} )
21122172
SAW_ARG=$?
@@ -2144,6 +2204,11 @@ function _complete_astra_group_db_command_createcdc() {
21442204
echo ${COMPREPLY[@]}
21452205
return 0
21462206
;;
2207+
--timeout)
2208+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
2209+
echo ${COMPREPLY[@]}
2210+
return 0
2211+
;;
21472212
--table)
21482213
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
21492214
echo ${COMPREPLY[@]}
@@ -3357,9 +3422,9 @@ function _complete_astra_group_token() {
33573422
CURR_CMD=${COMP_WORDS[2]}
33583423
fi
33593424

3360-
COMMANDS="create revoke list delete"
3425+
COMMANDS="get create revoke list delete"
33613426
if [[ ${COMP_CWORD} -eq 2 ]]; then
3362-
COMPREPLY=( $(_complete_astra_group_token_command_list "${COMMANDS}" ) )
3427+
COMPREPLY=( $(_complete_astra_group_token_command_get "${COMMANDS}" ) )
33633428
DEFAULT_GROUP_COMMAND_COMPLETIONS=(${COMPREPLY[@]})
33643429
COMPREPLY=( $(compgen -W "${COMMANDS} ${DEFAULT_GROUP_COMMAND_COMPLETIONS}" -- ${CURR_WORD}) )
33653430
echo ${COMPREPLY[@]}
@@ -3372,6 +3437,11 @@ function _complete_astra_group_token() {
33723437
echo ${COMPREPLY[@]}
33733438
return $?
33743439
;;
3440+
get)
3441+
COMPREPLY=( $(_complete_astra_group_token_command_get "${COMMANDS}" ) )
3442+
echo ${COMPREPLY[@]}
3443+
return $?
3444+
;;
33753445
create)
33763446
COMPREPLY=( $(_complete_astra_group_token_command_create "${COMMANDS}" ) )
33773447
echo ${COMPREPLY[@]}
@@ -3435,6 +3505,51 @@ function _complete_astra_group_token_command_list() {
34353505
return 0
34363506
}
34373507

3508+
function _complete_astra_group_token_command_get() {
3509+
# Get completion data
3510+
COMPREPLY=()
3511+
CURR_WORD=${COMP_WORDS[COMP_CWORD]}
3512+
PREV_WORD=${COMP_WORDS[COMP_CWORD-1]}
3513+
COMMANDS=$1
3514+
3515+
FLAG_OPTS="--no-color -v --verbose"
3516+
ARG_OPTS="--token -cf --config-file -o -conf --config --output"
3517+
3518+
$( containsElement ${PREV_WORD} ${ARG_OPTS[@]} )
3519+
SAW_ARG=$?
3520+
if [[ ${SAW_ARG} -eq 0 ]]; then
3521+
ARG_VALUES=
3522+
ARG_GENERATED_VALUES=
3523+
case ${PREV_WORD} in
3524+
--token)
3525+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
3526+
echo ${COMPREPLY[@]}
3527+
return 0
3528+
;;
3529+
-cf|--config-file)
3530+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
3531+
echo ${COMPREPLY[@]}
3532+
return 0
3533+
;;
3534+
-conf|--config)
3535+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
3536+
echo ${COMPREPLY[@]}
3537+
return 0
3538+
;;
3539+
-o|--output)
3540+
COMPREPLY=( $(compgen -W "${ARG_VALUES} ${ARG_GENERATED_VALUES}" -- ${CURR_WORD}) )
3541+
echo ${COMPREPLY[@]}
3542+
return 0
3543+
;;
3544+
esac
3545+
fi
3546+
3547+
ARGUMENTS=
3548+
COMPREPLY=( $(compgen -W "${FLAG_OPTS} ${ARG_OPTS} ${ARGUMENTS}" -- ${CURR_WORD}) )
3549+
echo ${COMPREPLY[@]}
3550+
return 0
3551+
}
3552+
34383553
function _complete_astra_group_token_command_create() {
34393554
# Get completion data
34403555
COMPREPLY=()

src/test/java/com/dtsx/astra/cli/test/db/DbCdcCommandsTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ public static void shouldInitializeEnvironment() {
4646
@Order(1)
4747
public void shouldCreateCdcs() throws InterruptedException {
4848
assertSuccessCli("db create-cdc %s -k %s --table demo --tenant %s -v".formatted(DB_TEST, DB_TEST, TENANT_TEST));
49-
5049
assertSuccessCli("db create-cdc %s -k %s --table table2 --tenant %s".formatted(DB_TEST, DB_TEST, TENANT_TEST));
51-
Thread.sleep(1000);
52-
Assertions.assertEquals(2, dbClient.cdc().findAll().toList().size());
53-
Assertions.assertEquals(2, tenantClient.cdc().list());
50+
Assertions.assertEquals(2L, dbClient.cdc().findAll().count());
51+
Assertions.assertEquals(2L, tenantClient.cdc().list().count());
5452
}
5553

5654
@Test
5755
@Order(2)
5856
public void shouldInsertDataWithCdc() {
59-
assertSuccessCli("db cqlsh %s -k %s -e \"INSERT INTO demo(foo,bar) VALUES('2','2');\"".formatted(DB_TEST, DB_TEST));
57+
if (!disableTools) {
58+
assertSuccessCli("db cqlsh %s -f src/test/resources/cdc_insert.cql".formatted(DB_TEST));
59+
}
6060
}
6161

6262
@Test

src/test/resources/cdc_insert.cql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
INSERT INTO astra_cli_test.demo(foo,bar) VALUES('2','2');

0 commit comments

Comments
 (0)