Skip to content

Commit

Permalink
Create test file for installer composer
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-brito authored and andrestc committed Oct 18, 2018
1 parent 61d9e58 commit 4252314
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tsuru/installer/compose_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2016 tsuru-client authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package installer

import (
"strings"

"github.com/tsuru/tsuru-client/tsuru/installer/defaultconfig"
"gopkg.in/check.v1"
)

func (s *S) TestResolverConfig(c *check.C) {
tt := []struct {
Description string
Base string
Config map[string]string
Result string
ErrMsg string
}{
{"invalid path", "invalid", nil, "", "no such file or directory"},
{"default configuration", "", nil, defaultconfig.Compose, ""},
{"custom parameter", "", map[string]string{"TSURU_API_IMAGE": "INJECT_TEST"}, "INJECT_TEST", ""},
}

for _, tc := range tt {
result, err := resolveConfig(tc.Base, tc.Config)
if len(tc.ErrMsg) > 0 {
contains := strings.Contains(err.Error(), tc.ErrMsg)
c.Assert(contains, check.Equals, true)
} else {
c.Assert(err, check.IsNil)
}
c.Assert(strings.Contains(result, tc.Result), check.Equals, true)
}
}

0 comments on commit 4252314

Please sign in to comment.