Skip to content

Commit

Permalink
added validation test (#664)
Browse files Browse the repository at this point in the history
* added validation test

* fixed test

* fixed wrong test dir path

* fixed comment

* added comments and updated format version

* update comments

* updated with PR change requests
  • Loading branch information
trapacska authored Apr 10, 2019
1 parent 73db173 commit fcba230
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
12 changes: 12 additions & 0 deletions _tests/integration/test_deploy_structure_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
format_version: 7
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

workflows:
test-deploy-dir-structure-check:
description: |
Check if test result dir is under test deploy dir
steps:
- script:
inputs:
- content: |-
if [[ "$(dirname $BITRISE_TEST_RESULT_DIR)" != "$BITRISE_TEST_DEPLOY_DIR" ]]; then exit 1; fi
20 changes: 20 additions & 0 deletions _tests/integration/test_deploy_structure_check_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package integration

import (
"testing"

"github.com/bitrise-io/go-utils/command"
)

func Test_DeployDirStructure(t *testing.T) {
t.Log("check test deploy dir structure")
{
configPth := "test_deploy_structure_check.yml"

cmd := command.New(binPath(), "run", "test-deploy-dir-structure-check", "--config", configPth)
out, err := cmd.RunAndReturnTrimmedCombinedOutput()
if err != nil {
t.Fatal(err, out)
}
}
}
4 changes: 2 additions & 2 deletions cli/run_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -887,15 +887,15 @@ func activateAndRunSteps(
})

// ensure a new testDirPath and if created successfuly then attach it to the step process by and env
testDirPath, err := ioutil.TempDir(os.Getenv(configs.BitriseTestResultDirEnvKey), "test_result")
testDirPath, err := ioutil.TempDir(os.Getenv(configs.BitriseTestDeployDirEnvKey), "test_result")
if err != nil {
log.Errorf("Failed to create test result dir, error: %s", err)
}

if testDirPath != "" {
// managed to create the test dir, set the env for it for the next step run
additionalEnvironments = append(additionalEnvironments, envmanModels.EnvironmentItemModel{
configs.BitriseTestResultDirEnvKey: testDirPath,
configs.BitrisePerStepTestResultDirEnvKey: testDirPath,
})
}

Expand Down
6 changes: 3 additions & 3 deletions configs/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ const (
BitriseSourceDirEnvKey = "BITRISE_SOURCE_DIR"
// BitriseDeployDirEnvKey ...
BitriseDeployDirEnvKey = "BITRISE_DEPLOY_DIR"
// BitriseTestDeployDirEnvKey ...
// BitriseTestDeployDirEnvKey is the root directory of test reports
BitriseTestDeployDirEnvKey = "BITRISE_TEST_DEPLOY_DIR"
// BitriseTestResultDirEnvKey ...
BitriseTestResultDirEnvKey = "BITRISE_TEST_RESULT_DIR"
// BitrisePerStepTestResultDirEnvKey is a unique subdirectory in BITRISE_TEST_DEPLOY_DIR for each step run, steps should place test reports and attachments into this directory
BitrisePerStepTestResultDirEnvKey = "BITRISE_TEST_RESULT_DIR"
// BitriseCacheDirEnvKey ...
BitriseCacheDirEnvKey = "BITRISE_CACHE_DIR"
// BitriseTmpDirEnvKey ...
Expand Down

0 comments on commit fcba230

Please sign in to comment.