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
4db6cd93
Commit
4db6cd93
authored
Jul 01, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(test): match output using regexp
parent
2fb8b607
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
get_test.go
cmd/helm/get_test.go
+5
-4
list_test.go
cmd/helm/list_test.go
+9
-8
No files found.
cmd/helm/get_test.go
View file @
4db6cd93
...
@@ -18,6 +18,7 @@ package main
...
@@ -18,6 +18,7 @@ package main
import
(
import
(
"bytes"
"bytes"
"regexp"
"testing"
"testing"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm"
...
@@ -40,7 +41,7 @@ func TestGetCmd(t *testing.T) {
...
@@ -40,7 +41,7 @@ func TestGetCmd(t *testing.T) {
},
},
},
},
args
:
[]
string
{
"thomas-guide"
},
args
:
[]
string
{
"thomas-guide"
},
expected
:
"CHART: foo-0.1.0-beta.1
\n
RELEASED:
Fri Sep 2 15:04:05 1977
\n
USER-SUPPLIED VALUES:
\n
name:
\"
value
\"\n
COMPUTED VALUES:
\n
name: value
\n\n
MANIFEST:"
,
expected
:
"CHART: foo-0.1.0-beta.1
\n
RELEASED:
(.*)
\n
USER-SUPPLIED VALUES:
\n
name:
\"
value
\"\n
COMPUTED VALUES:
\n
name: value
\n\n
MANIFEST:"
,
},
},
{
{
name
:
"requires release name arg"
,
name
:
"requires release name arg"
,
...
@@ -56,9 +57,9 @@ func TestGetCmd(t *testing.T) {
...
@@ -56,9 +57,9 @@ func TestGetCmd(t *testing.T) {
if
(
err
!=
nil
)
!=
tt
.
err
{
if
(
err
!=
nil
)
!=
tt
.
err
{
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
}
}
actual
:=
string
(
bytes
.
TrimSpace
(
buf
.
Bytes
())
)
re
:=
regexp
.
MustCompile
(
tt
.
expected
)
if
actual
!=
tt
.
expected
{
if
!
re
.
Match
(
buf
.
Bytes
())
{
t
.
Errorf
(
"%q. expected %q, got %q"
,
tt
.
name
,
tt
.
expected
,
actual
)
t
.
Errorf
(
"%q. expected %q, got %q"
,
tt
.
name
,
tt
.
expected
,
buf
.
String
()
)
}
}
buf
.
Reset
()
buf
.
Reset
()
}
}
...
...
cmd/helm/list_test.go
View file @
4db6cd93
...
@@ -18,6 +18,7 @@ package main
...
@@ -18,6 +18,7 @@ package main
import
(
import
(
"bytes"
"bytes"
"regexp"
"testing"
"testing"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm"
...
@@ -52,7 +53,7 @@ func TestListRun(t *testing.T) {
...
@@ -52,7 +53,7 @@ func TestListRun(t *testing.T) {
},
},
long
:
true
,
long
:
true
,
},
},
expected
:
"NAME
\t
UPDATED
\t
STATUS
\t
CHART
\n
atlas
\t
Fri Sep 2 15:04:05 1977
\t
DEPLOYED
\t
foo-0.1.0-beta.1"
,
expected
:
"NAME
\t
UPDATED
\t
STATUS
\t
CHART
\n
atlas
\t
(.*)
\t
DEPLOYED
\t
foo-0.1.0-beta.1"
,
},
},
}
}
...
@@ -63,9 +64,9 @@ func TestListRun(t *testing.T) {
...
@@ -63,9 +64,9 @@ func TestListRun(t *testing.T) {
if
(
err
!=
nil
)
!=
tt
.
err
{
if
(
err
!=
nil
)
!=
tt
.
err
{
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
}
}
actual
:=
string
(
bytes
.
TrimSpace
(
buf
.
Bytes
())
)
re
:=
regexp
.
MustCompile
(
tt
.
expected
)
if
actual
!=
tt
.
expected
{
if
!
re
.
Match
(
buf
.
Bytes
())
{
t
.
Errorf
(
"%q. expected %q, got %q"
,
tt
.
name
,
tt
.
expected
,
actual
)
t
.
Errorf
(
"%q. expected %q, got %q"
,
tt
.
name
,
tt
.
expected
,
buf
.
String
()
)
}
}
buf
.
Reset
()
buf
.
Reset
()
}
}
...
@@ -97,7 +98,7 @@ func TestListCmd(t *testing.T) {
...
@@ -97,7 +98,7 @@ func TestListCmd(t *testing.T) {
releaseMock
(
"atlas"
),
releaseMock
(
"atlas"
),
},
},
},
},
expected
:
"NAME
\t
UPDATED
\t
STATUS
\t
CHART
\n
atlas
\t
Fri Sep 2 15:04:05 1977
\t
DEPLOYED
\t
foo-0.1.0-beta.1"
,
expected
:
"NAME
\t
UPDATED
\t
STATUS
\t
CHART
\n
atlas
\t
(.*)
\t
DEPLOYED
\t
foo-0.1.0-beta.1"
,
},
},
}
}
...
@@ -111,9 +112,9 @@ func TestListCmd(t *testing.T) {
...
@@ -111,9 +112,9 @@ func TestListCmd(t *testing.T) {
if
(
err
!=
nil
)
!=
tt
.
err
{
if
(
err
!=
nil
)
!=
tt
.
err
{
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
}
}
actual
:=
string
(
bytes
.
TrimSpace
(
buf
.
Bytes
())
)
re
:=
regexp
.
MustCompile
(
tt
.
expected
)
if
actual
!=
tt
.
expected
{
if
!
re
.
Match
(
buf
.
Bytes
())
{
t
.
Errorf
(
"%q. expected %q, got %q"
,
tt
.
name
,
tt
.
expected
,
actual
)
t
.
Errorf
(
"%q. expected %q, got %q"
,
tt
.
name
,
tt
.
expected
,
buf
.
String
()
)
}
}
buf
.
Reset
()
buf
.
Reset
()
}
}
...
...
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