Commit cbdbb466 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'update-tests' into 'master'

Refactor TestDefaultVariables test

See merge request gitlab-org/gitlab-runner!1301
parents ee2f3bf9 b9d932d9
......@@ -1276,29 +1276,25 @@ func TestGitCleanFlags(t *testing.T) {
}
func TestDefaultVariables(t *testing.T) {
tests := []struct {
name string
tests := map[string]struct {
jobVariables JobVariables
rootDir string
key string
expectedValue string
}{
{
name: "get default CI_SERVER value",
"get default CI_SERVER value": {
jobVariables: JobVariables{},
rootDir: "/builds",
key: "CI_SERVER",
expectedValue: "yes",
},
{
name: "get default CI_PROJECT_DIR value",
"get default CI_PROJECT_DIR value": {
jobVariables: JobVariables{},
rootDir: "/builds",
key: "CI_PROJECT_DIR",
expectedValue: "/builds/test-namespace/test-repo",
},
{
name: "get overwritten CI_PROJECT_DIR value",
"get overwritten CI_PROJECT_DIR value": {
jobVariables: JobVariables{
{Key: "GIT_CLONE_PATH", Value: "/builds/go/src/gitlab.com/gitlab-org/gitlab-runner", Public: true},
},
......@@ -1308,8 +1304,8 @@ func TestDefaultVariables(t *testing.T) {
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
for name, test := range tests {
t.Run(name, func(t *testing.T) {
build := Build{
JobResponse: JobResponse{
GitInfo: GitInfo{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment