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
cdd9a856
Commit
cdd9a856
authored
Mar 09, 2018
by
Arash Deshmeh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(helm): remove duplicate code from cmd/helm/history_test.go. Closes #3649
Signed-off-by:
Arash Deshmeh
<
adeshmeh@ca.ibm.com
>
parent
c5f2174f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
33 deletions
+15
-33
history_test.go
cmd/helm/history_test.go
+15
-33
No files found.
cmd/helm/history_test.go
View file @
cdd9a856
...
...
@@ -17,10 +17,11 @@ limitations under the License.
package
main
import
(
"bytes"
"regexp"
"io"
"testing"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/helm"
rpb
"k8s.io/helm/pkg/proto/hapi/release"
)
...
...
@@ -34,50 +35,31 @@ func TestHistoryCmd(t *testing.T) {
})
}
tests
:=
[]
struct
{
cmds
string
desc
string
args
[]
string
resp
[]
*
rpb
.
Release
xout
string
}{
tests
:=
[]
releaseCase
{
{
cmds
:
"helm history RELEASE_NAME"
,
desc
:
"get history for release"
,
name
:
"get history for release"
,
args
:
[]
string
{
"angry-bird"
},
re
sp
:
[]
*
rpb
.
Release
{
re
ls
:
[]
*
rpb
.
Release
{
mk
(
"angry-bird"
,
4
,
rpb
.
Status_DEPLOYED
),
mk
(
"angry-bird"
,
3
,
rpb
.
Status_SUPERSEDED
),
mk
(
"angry-bird"
,
2
,
rpb
.
Status_SUPERSEDED
),
mk
(
"angry-bird"
,
1
,
rpb
.
Status_SUPERSEDED
),
},
xout
:
"REVISION
\t
UPDATED
\t
STATUS
\t
CHART
\t
DESCRIPTION
\n
1
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
2
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
3
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
4
\t
(.*)
\t
DEPLOYED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
"
,
expected
:
"REVISION
\t
UPDATED
\t
STATUS
\t
CHART
\t
DESCRIPTION
\n
1
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
2
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
3
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
4
\t
(.*)
\t
DEPLOYED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
"
,
},
{
cmds
:
"helm history --max=MAX RELEASE_NAME
"
,
desc
:
"get history with max limit set"
,
args
:
[]
string
{
"--max=2"
,
"angry-bird
"
},
re
sp
:
[]
*
rpb
.
Release
{
name
:
"get history with max limit set
"
,
args
:
[]
string
{
"angry-bird"
}
,
flags
:
[]
string
{
"--max"
,
"2
"
},
re
ls
:
[]
*
rpb
.
Release
{
mk
(
"angry-bird"
,
4
,
rpb
.
Status_DEPLOYED
),
mk
(
"angry-bird"
,
3
,
rpb
.
Status_SUPERSEDED
),
},
xout
:
"REVISION
\t
UPDATED
\t
STATUS
\t
CHART
\t
DESCRIPTION
\n
3
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
4
\t
(.*)
\t
DEPLOYED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
"
,
expected
:
"REVISION
\t
UPDATED
\t
STATUS
\t
CHART
\t
DESCRIPTION
\n
3
\t
(.*)
\t
SUPERSEDED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
4
\t
(.*)
\t
DEPLOYED
\t
foo-0.1.0-beta.1
\t
Release mock
\n
"
,
},
}
var
buf
bytes
.
Buffer
for
_
,
tt
:=
range
tests
{
frc
:=
&
helm
.
FakeClient
{
Rels
:
tt
.
resp
}
cmd
:=
newHistoryCmd
(
frc
,
&
buf
)
cmd
.
ParseFlags
(
tt
.
args
)
if
err
:=
cmd
.
RunE
(
cmd
,
tt
.
args
);
err
!=
nil
{
t
.
Fatalf
(
"%q
\n\t
%s: unexpected error: %v"
,
tt
.
cmds
,
tt
.
desc
,
err
)
}
re
:=
regexp
.
MustCompile
(
tt
.
xout
)
if
!
re
.
Match
(
buf
.
Bytes
())
{
t
.
Fatalf
(
"%q
\n\t
%s:
\n
expected
\n\t
%q
\n
actual
\n\t
%q"
,
tt
.
cmds
,
tt
.
desc
,
tt
.
xout
,
buf
.
String
())
}
buf
.
Reset
()
}
runReleaseCases
(
t
,
tests
,
func
(
c
*
helm
.
FakeClient
,
out
io
.
Writer
)
*
cobra
.
Command
{
return
newHistoryCmd
(
c
,
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