-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create test file for installer composer
- Loading branch information
1 parent
61d9e58
commit 4252314
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |