Skip to content

Commit a66c0d9

Browse files
committed
fix(tests): initialize environment variables in test cases for consistency
1 parent f3eea69 commit a66c0d9

2 files changed

Lines changed: 33 additions & 11 deletions

File tree

cmd/sling/sling_cli_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ func TestCLI(t *testing.T) {
106106
continue
107107
}
108108

109-
tc.Env = map[string]string{
110-
"DEBUG": os.Getenv("DEBUG"),
109+
if len(tc.Env) == 0 {
110+
tc.Env = map[string]string{}
111111
}
112112

113113
if tc.Rows != "" {

cmd/sling/tests/suite.cli.yaml

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@
122122

123123
- id: 22
124124
name: Run sling with JSON source and custom columns
125-
run: 'SLING_LOADED_AT_COLUMN=false SLING_STREAM_URL_COLUMN=true SLING_ROW_NUM_COLUMN=true sling run --src-stream file://core/dbio/filesys/test/test1/json --tgt-conn postgres --tgt-object public.many_jsons --mode full-refresh'
125+
run: SLING_STREAM_URL_COLUMN=true SLING_ROW_NUM_COLUMN=true sling run --src-stream file://core/dbio/filesys/test/test1/json --tgt-conn postgres --tgt-object public.many_jsons --mode full-refresh
126+
env:
127+
SLING_LOADED_AT_COLUMN: 'false'
126128
rows: 2019
127129

128130
- id: 23
@@ -275,7 +277,9 @@
275277

276278
- id: 47
277279
name: Run sling with replication configuration 15 incremental
278-
run: 'ICEBERG_MODE=incremental sling run -r cmd/sling/tests/replications/r.15.yaml --streams sling_test/lineitem_iceberg/'
280+
run: sling run -r cmd/sling/tests/replications/r.15.yaml --streams sling_test/lineitem_iceberg/
281+
env:
282+
ICEBERG_MODE: incremental
279283
rows: '>0'
280284
streams: 1
281285
output_contains:
@@ -401,7 +405,9 @@
401405

402406
- id: 67
403407
name: 'Run sling hooks & source partitioned (backfill)'
404-
run: 'RESET=true sling run -r cmd/sling/tests/replications/r.19.yaml -d --mode backfill --range 2018-01-01,2019-05-01'
408+
run: 'sling run -r cmd/sling/tests/replications/r.19.yaml -d --mode backfill --range 2018-01-01,2019-05-01'
409+
env:
410+
RESET: 'true'
405411
rows: 551
406412
output_contains:
407413
- 'executed hook "start-02" (type: delete)'
@@ -455,7 +461,9 @@
455461

456462
- id: 74
457463
name: Run sling iceberg_r2 insert
458-
run: 'TARGET=iceberg_r2 sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml'
464+
run: sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml
465+
env:
466+
TARGET: iceberg_r2
459467
streams: 2
460468
output_contains:
461469
- committed iceberg snapshot
@@ -464,7 +472,9 @@
464472

465473
- id: 75
466474
name: Run sling iceberg_s3 insert
467-
run: 'TARGET=iceberg_s3 sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml'
475+
run: sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml
476+
env:
477+
TARGET: iceberg_s3
468478
streams: 2
469479
output_contains:
470480
- committed iceberg snapshot
@@ -473,7 +483,9 @@
473483

474484
- id: 76
475485
name: Run sling iceberg_lakekeeper insert
476-
run: 'TARGET=iceberg_lakekeeper sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml'
486+
run: sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml
487+
env:
488+
TARGET: iceberg_lakekeeper
477489
streams: 2
478490
output_contains:
479491
- committed iceberg snapshot
@@ -482,7 +494,9 @@
482494

483495
- id: 77
484496
name: Run sling iceberg_sql insert
485-
run: 'TARGET=iceberg_sql sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml'
497+
run: sling run -d -r cmd/sling/tests/replications/r.23.iceberg_write.yaml
498+
env:
499+
TARGET: iceberg_sql
486500
streams: 2
487501
output_contains:
488502
- committed iceberg snapshot
@@ -540,12 +554,20 @@
540554

541555
- id: 84
542556
name: Oracle NUMBER scale fix (https://github.com/slingdata-io/sling-cli/issues/584)
543-
run: SCHEMA=ORACLE SOURCE=ORACLE TARGET=SNOWFLAKE sling run -r cmd/sling/tests/replications/r.28.oracle_number_scale.yaml
557+
run: sling run -r cmd/sling/tests/replications/r.28.oracle_number_scale.yaml
558+
env:
559+
SCHEMA: ORACLE
560+
SOURCE: ORACLE
561+
TARGET: SNOWFLAKE
544562
output_contains:
545563
- 'execution succeeded'
546564

547565
- id: 85
548566
name: Oracle NUMBER scale fix (https://github.com/slingdata-io/sling-cli/issues/584)
549-
run: SCHEMA=ORACLE SOURCE=ORACLE TARGET=POSTGRES sling run -r cmd/sling/tests/replications/r.28.oracle_number_scale.yaml
567+
run: sling run -r cmd/sling/tests/replications/r.28.oracle_number_scale.yaml
568+
env:
569+
SCHEMA: ORACLE
570+
SOURCE: ORACLE
571+
TARGET: POSTGRES
550572
output_contains:
551573
- 'execution succeeded'

0 commit comments

Comments
 (0)