From 1bb291615f3ae7ac83bb6788a2c1a4a16b7aba6a Mon Sep 17 00:00:00 2001 From: dittrichlucas Date: Wed, 27 Oct 2021 10:42:03 -0300 Subject: [PATCH 1/3] test: add functional tests for error cases in env commands Signed-off-by: dittrichlucas --- .github/workflows/test-env-commands.yml | 20 ++++++++++++++++++- .../gha_workflows/env_workflow/assert3.txt | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 testdata/gha_workflows/env_workflow/assert3.txt diff --git a/.github/workflows/test-env-commands.yml b/.github/workflows/test-env-commands.yml index e2be92b00..a76bf0cd0 100644 --- a/.github/workflows/test-env-commands.yml +++ b/.github/workflows/test-env-commands.yml @@ -83,6 +83,12 @@ jobs: command_line: rit show env assert_file_path: testdata/gha_workflows/env_workflow/assert1.txt expected_result: PASSED + - name: RIT SET ENV command ERROR (4) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: rit set env --flag=test + assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt + expected_result: PASSED macos: runs-on: macos-latest @@ -118,7 +124,13 @@ jobs: command_line: rit show env assert_file_path: testdata/gha_workflows/env_workflow/assert1.txt expected_result: PASSED - + - name: RIT SET ENV command ERROR (4) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: rit set env --flag=test + assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt + expected_result: PASSED + windows: runs-on: windows-latest steps: @@ -154,3 +166,9 @@ jobs: command_line: ./rit.exe show env assert_file_path: testdata/gha_workflows/env_workflow/assert1.txt expected_result: PASSED + - name: RIT SET ENV command ERROR (4) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: ./rit.exe set env --flag=test + assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt + expected_result: PASSED diff --git a/testdata/gha_workflows/env_workflow/assert3.txt b/testdata/gha_workflows/env_workflow/assert3.txt new file mode 100644 index 000000000..c3712cffa --- /dev/null +++ b/testdata/gha_workflows/env_workflow/assert3.txt @@ -0,0 +1 @@ +Error: unknown flag: --flag From 462a84c54ae09abbecf50712378771852590727d Mon Sep 17 00:00:00 2001 From: dittrichlucas Date: Wed, 27 Oct 2021 10:49:44 -0300 Subject: [PATCH 2/3] test: add the specific_line arg for error test cases Signed-off-by: dittrichlucas --- .github/workflows/test-env-commands.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-env-commands.yml b/.github/workflows/test-env-commands.yml index a76bf0cd0..c96f98e13 100644 --- a/.github/workflows/test-env-commands.yml +++ b/.github/workflows/test-env-commands.yml @@ -89,6 +89,7 @@ jobs: command_line: rit set env --flag=test assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt expected_result: PASSED + specific_line: 1 macos: runs-on: macos-latest @@ -130,6 +131,7 @@ jobs: command_line: rit set env --flag=test assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt expected_result: PASSED + specific_line: 1 windows: runs-on: windows-latest @@ -172,3 +174,4 @@ jobs: command_line: ./rit.exe set env --flag=test assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt expected_result: PASSED + specific_line: 1 From acb196752e6cc220a50465c2a3eee220dcc7d8cf Mon Sep 17 00:00:00 2001 From: dittrichlucas Date: Wed, 27 Oct 2021 10:58:15 -0300 Subject: [PATCH 3/3] test: add error tests to delete env command Signed-off-by: dittrichlucas --- .github/workflows/test-env-commands.yml | 39 +++++++++++++++++++ .../gha_workflows/env_workflow/assert4.txt | 1 + 2 files changed, 40 insertions(+) create mode 100644 testdata/gha_workflows/env_workflow/assert4.txt diff --git a/.github/workflows/test-env-commands.yml b/.github/workflows/test-env-commands.yml index c96f98e13..657bd45ff 100644 --- a/.github/workflows/test-env-commands.yml +++ b/.github/workflows/test-env-commands.yml @@ -90,6 +90,19 @@ jobs: assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt expected_result: PASSED specific_line: 1 + - name: RIT DELETE ENV command ERROR (5) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: rit delete env --flag=test + assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt + expected_result: PASSED + specific_line: 1 + - name: RIT DELETE ENV command ERROR (6) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: rit delete env --env=new_test + assert_file_path: testdata/gha_workflows/env_workflow/assert4.txt + expected_result: PASSED macos: runs-on: macos-latest @@ -132,6 +145,19 @@ jobs: assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt expected_result: PASSED specific_line: 1 + - name: RIT DELETE ENV command ERROR (5) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: rit delete env --flag=test + assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt + expected_result: PASSED + specific_line: 1 + - name: RIT DELETE ENV command ERROR (6) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: rit delete env --env=new_test + assert_file_path: testdata/gha_workflows/env_workflow/assert4.txt + expected_result: PASSED windows: runs-on: windows-latest @@ -175,3 +201,16 @@ jobs: assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt expected_result: PASSED specific_line: 1 + - name: RIT DELETE ENV command ERROR (5) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: ./rit.exe delete env --flag=test + assert_file_path: testdata/gha_workflows/env_workflow/assert3.txt + expected_result: PASSED + specific_line: 1 + - name: RIT DELETE ENV command ERROR (6) + uses: GuillaumeFalourd/test-cli-commands-action@v1 + with: + command_line: ./rit.exe delete env --env=new_test + assert_file_path: testdata/gha_workflows/env_workflow/assert4.txt + expected_result: PASSED diff --git a/testdata/gha_workflows/env_workflow/assert4.txt b/testdata/gha_workflows/env_workflow/assert4.txt new file mode 100644 index 000000000..5f29d45ea --- /dev/null +++ b/testdata/gha_workflows/env_workflow/assert4.txt @@ -0,0 +1 @@ +Error: env 'new_test' not found, please provide a value for env valid