Skip to content

Commit f35e409

Browse files
authored
Add PIPELINES environment variable to acceptance test framework (#3170)
## Changes Added a new `PIPELINES` environment variable to the acceptance test framework that provides a copy of the CLI binary named "pipelines". This eliminates the need to manually install the pipelines CLI in test scripts using `install-pipelines-cli` command. - Modified `acceptance/acceptance_test.go` to create a copy of the CLI binary as "pipelines" and set the `PIPELINES` environment variable - Added path replacement for the PIPELINES binary in test output normalization ## Why Currently, test scripts that need to use the pipelines CLI must first run `install-pipelines-cli` to create a local copy. This adds unnecessary complexity and setup time to tests. By providing the `PIPELINES` environment variable directly in the acceptance test framework, tests can immediately use `$PIPELINES` without any installation step, making tests simpler and faster. This change follows the same pattern as the existing `CLI` environment variable, providing consistency in how test binaries are made available to test scripts. ## Tests - All existing tests continue to pass, ensuring no regression, using new `$PIPELINES`
1 parent 3356a97 commit f35e409

File tree

7 files changed

+16
-51
lines changed

7 files changed

+16
-51
lines changed

acceptance/acceptance_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ func testAccept(t *testing.T, inprocessMode bool, singleTest string) int {
165165
t.Setenv("CLI", execPath)
166166
repls.SetPath(execPath, "[CLI]")
167167

168+
pipelinesPath := filepath.Join(buildDir, "pipelines") + exeSuffix
169+
err = copyFile(execPath, pipelinesPath)
170+
require.NoError(t, err)
171+
t.Setenv("PIPELINES", pipelinesPath)
172+
repls.SetPath(pipelinesPath, "[PIPELINES]")
173+
168174
paths := []string{
169175
// Make helper scripts available
170176
filepath.Join(cwd, "bin"),
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11

2-
=== Install pipelines CLI
3-
>>> errcode [CLI] install-pipelines-cli -d ./subdir
4-
pipelines successfully installed in directory "./subdir"
5-
62
=== Test with missing config file
7-
>>> errcode ./subdir/pipelines init --output-dir output
3+
>>> errcode [PIPELINES] init --output-dir output
84

95
Welcome to the template for pipelines!
106

@@ -14,13 +10,13 @@ Your new project has been created in the 'my_project' directory!
1410
Refer to the README.md file for "getting started" instructions!
1511

1612
=== Test with invalid project name (contains uppercase letters)
17-
>>> errcode ./subdir/pipelines init --config-file ./invalid_input.json --output-dir invalid-output
13+
>>> errcode [PIPELINES] init --config-file ./invalid_input.json --output-dir invalid-output
1814
Error: failed to load config from file ./invalid_input.json: invalid value for project_name: "InvalidProjectName". Name must consist of lower case letters, numbers, and underscores.
1915

2016
Exit code: 1
2117

2218
=== Test with non-existent config file
23-
>>> errcode ./subdir/pipelines init --config-file ./nonexistent.json --output-dir invalid-output-2
19+
>>> errcode [PIPELINES] init --config-file ./nonexistent.json --output-dir invalid-output-2
2420
Error: failed to load config from file ./nonexistent.json: open ./nonexistent.json: no such file or directory
2521

2622
Exit code: 1
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
tmpdir="./subdir"
2-
pipelines="$tmpdir/pipelines"
3-
mkdir -p $tmpdir
4-
5-
title "Install pipelines CLI"
6-
trace errcode $CLI install-pipelines-cli -d $tmpdir
7-
81
title "Test with missing config file"
9-
trace errcode $pipelines init --output-dir output
2+
trace errcode $PIPELINES init --output-dir output
103

114
title "Test with invalid project name (contains uppercase letters)"
125
echo '{"project_name": "InvalidProjectName"}' > invalid_input.json
13-
trace errcode $pipelines init --config-file ./invalid_input.json --output-dir invalid-output
6+
trace errcode $PIPELINES init --config-file ./invalid_input.json --output-dir invalid-output
147

158
title "Test with non-existent config file"
16-
trace errcode $pipelines init --config-file ./nonexistent.json --output-dir invalid-output-2
9+
trace errcode $PIPELINES init --config-file ./nonexistent.json --output-dir invalid-output-2
1710

1811
# Do not affect this repository's git behaviour
1912
mv output/my_project/.gitignore output/my_project/out.gitignore
2013

2114
# Clean up
2215
rm -f invalid_input.json
23-
rm -f $pipelines
24-
rm -rf $tmpdir

acceptance/pipelines/init/python/output.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11

2-
=== Install pipelines CLI
3-
>>> errcode [CLI] install-pipelines-cli -d ./subdir
4-
pipelines successfully installed in directory "./subdir"
5-
62
=== Test basic pipelines init with configuration file
7-
>>> ./subdir/pipelines init --config-file ./input.json --output-dir output
3+
>>> [PIPELINES] init --config-file ./input.json --output-dir output
84

95
Welcome to the template for pipelines!
106

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
tmpdir="./subdir"
2-
pipelines="$tmpdir/pipelines"
3-
mkdir -p $tmpdir
4-
5-
title "Install pipelines CLI"
6-
trace errcode $CLI install-pipelines-cli -d $tmpdir
7-
81
title "Test basic pipelines init with configuration file"
9-
trace $pipelines init --config-file ./input.json --output-dir output
2+
trace $PIPELINES init --config-file ./input.json --output-dir output
103

114
mv output/my_python_project/.gitignore output/my_python_project/out.gitignore
12-
13-
rm -f $pipelines
14-
rm -rf $tmpdir

acceptance/pipelines/init/sql/output.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11

2-
=== Install pipelines CLI
3-
>>> errcode [CLI] install-pipelines-cli -d ./subdir
4-
pipelines successfully installed in directory "./subdir"
5-
62
=== Test pipelines init with SQL configuration
7-
>>> ./subdir/pipelines init --config-file ./input.json --output-dir output
3+
>>> [PIPELINES] init --config-file ./input.json --output-dir output
84

95
Welcome to the template for pipelines!
106

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
tmpdir="./subdir"
2-
pipelines="$tmpdir/pipelines"
3-
mkdir -p $tmpdir
4-
5-
title "Install pipelines CLI"
6-
trace errcode $CLI install-pipelines-cli -d $tmpdir
7-
81
title "Test pipelines init with SQL configuration"
9-
trace $pipelines init --config-file ./input.json --output-dir output
2+
trace $PIPELINES init --config-file ./input.json --output-dir output
103

114
# Do not affect this repository's git behaviour
125
mv output/my_sql_project/.gitignore output/my_sql_project/out.gitignore
13-
14-
rm -f $pipelines
15-
rm -rf $tmpdir

0 commit comments

Comments
 (0)