Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
74bf7584
Commit
74bf7584
authored
Mar 16, 2018
by
Arash Deshmeh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(helm): refactor tests on helm dependency list command to remove duplication
Signed-off-by:
Arash Deshmeh
<
adeshmeh@ca.ibm.com
>
parent
4711d5b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
28 deletions
+12
-28
dependency_test.go
cmd/helm/dependency_test.go
+12
-28
No files found.
cmd/helm/dependency_test.go
View file @
74bf7584
...
...
@@ -16,19 +16,17 @@ limitations under the License.
package
main
import
(
"bytes"
"strings"
"io"
"testing"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/helm"
)
func
TestDependencyListCmd
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
name
string
args
[]
string
expect
string
err
bool
}{
tests
:=
[]
releaseCase
{
{
name
:
"No such chart"
,
args
:
[]
string
{
"/no/such/chart"
},
...
...
@@ -37,12 +35,12 @@ func TestDependencyListCmd(t *testing.T) {
{
name
:
"No requirements.yaml"
,
args
:
[]
string
{
"testdata/testcharts/alpine"
},
expect
:
"WARNING: no requirements at "
,
expect
ed
:
"WARNING: no requirements at "
,
},
{
name
:
"Requirements in chart dir"
,
args
:
[]
string
{
"testdata/testcharts/reqtest"
},
expect
:
"NAME
\t
VERSION
\t
REPOSITORY
\t
STATUS
\n
"
+
expect
ed
:
"NAME
\t
VERSION
\t
REPOSITORY
\t
STATUS
\n
"
+
"reqsubchart
\t
0.1.0
\t
https://example.com/charts
\t
unpacked
\n
"
+
"reqsubchart2
\t
0.2.0
\t
https://example.com/charts
\t
unpacked
\n
"
+
"reqsubchart3
\t
>=0.1.0
\t
https://example.com/charts
\t
ok
\n\n
"
,
...
...
@@ -50,25 +48,11 @@ func TestDependencyListCmd(t *testing.T) {
{
name
:
"Requirements in chart archive"
,
args
:
[]
string
{
"testdata/testcharts/reqtest-0.1.0.tgz"
},
expect
:
"NAME
\t
VERSION
\t
REPOSITORY
\t
STATUS
\n
reqsubchart
\t
0.1.0
\t
https://example.com/charts
\t
missing
\n
reqsubchart2
\t
0.2.0
\t
https://example.com/charts
\t
missing
\n
"
,
expect
ed
:
"NAME
\t
VERSION
\t
REPOSITORY
\t
STATUS
\n
reqsubchart
\t
0.1.0
\t
https://example.com/charts
\t
missing
\n
reqsubchart2
\t
0.2.0
\t
https://example.com/charts
\t
missing
\n
"
,
},
}
for
_
,
tt
:=
range
tests
{
buf
:=
bytes
.
NewBuffer
(
nil
)
dlc
:=
newDependencyListCmd
(
buf
)
if
err
:=
dlc
.
RunE
(
dlc
,
tt
.
args
);
err
!=
nil
{
if
tt
.
err
{
continue
}
t
.
Errorf
(
"Test %q: %s"
,
tt
.
name
,
err
)
continue
}
got
:=
buf
.
String
()
if
!
strings
.
Contains
(
got
,
tt
.
expect
)
{
t
.
Errorf
(
"Test: %q, Expected:
\n
%q
\n
Got:
\n
%q"
,
tt
.
name
,
tt
.
expect
,
got
)
}
}
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newDependencyListCmd
(
out
)
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment