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
4dd77e77
Unverified
Commit
4dd77e77
authored
Dec 12, 2016
by
Vaughn Dice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(helm): add newline to fetch --verify output
parent
0d436e5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
18 deletions
+32
-18
fetch.go
cmd/helm/fetch.go
+1
-1
fetch_test.go
cmd/helm/fetch_test.go
+31
-17
No files found.
cmd/helm/fetch.go
View file @
4dd77e77
...
@@ -124,7 +124,7 @@ func (f *fetchCmd) run() error {
...
@@ -124,7 +124,7 @@ func (f *fetchCmd) run() error {
}
}
if
f
.
verify
{
if
f
.
verify
{
fmt
.
Fprintf
(
f
.
out
,
"Verification: %v"
,
v
)
fmt
.
Fprintf
(
f
.
out
,
"Verification: %v
\n
"
,
v
)
}
}
// After verification, untar the chart into the requested directory.
// After verification, untar the chart into the requested directory.
...
...
cmd/helm/fetch_test.go
View file @
4dd77e77
...
@@ -18,8 +18,10 @@ package main
...
@@ -18,8 +18,10 @@ package main
import
(
import
(
"bytes"
"bytes"
"fmt"
"os"
"os"
"path/filepath"
"path/filepath"
"regexp"
"testing"
"testing"
"k8s.io/helm/pkg/repo/repotest"
"k8s.io/helm/pkg/repo/repotest"
...
@@ -39,13 +41,14 @@ func TestFetchCmd(t *testing.T) {
...
@@ -39,13 +41,14 @@ func TestFetchCmd(t *testing.T) {
// all flags will get "--home=TMDIR -d outdir" appended.
// all flags will get "--home=TMDIR -d outdir" appended.
tests
:=
[]
struct
{
tests
:=
[]
struct
{
name
string
name
string
chart
string
chart
string
flags
[]
string
flags
[]
string
fail
bool
fail
bool
failExpect
string
failExpect
string
expectFile
string
expectFile
string
expectDir
bool
expectDir
bool
expectVerify
bool
}{
}{
{
{
name
:
"Basic chart fetch"
,
name
:
"Basic chart fetch"
,
...
@@ -72,10 +75,11 @@ func TestFetchCmd(t *testing.T) {
...
@@ -72,10 +75,11 @@ func TestFetchCmd(t *testing.T) {
fail
:
true
,
fail
:
true
,
},
},
{
{
name
:
"Fetch and verify"
,
name
:
"Fetch and verify"
,
chart
:
"test/signtest"
,
chart
:
"test/signtest"
,
flags
:
[]
string
{
"--verify"
,
"--keyring"
,
"testdata/helm-test-key.pub"
},
flags
:
[]
string
{
"--verify"
,
"--keyring"
,
"testdata/helm-test-key.pub"
},
expectFile
:
"./signtest-0.1.0.tgz"
,
expectFile
:
"./signtest-0.1.0.tgz"
,
expectVerify
:
true
,
},
},
{
{
name
:
"Fetch and fail verify"
,
name
:
"Fetch and fail verify"
,
...
@@ -87,16 +91,17 @@ func TestFetchCmd(t *testing.T) {
...
@@ -87,16 +91,17 @@ func TestFetchCmd(t *testing.T) {
{
{
name
:
"Fetch and untar"
,
name
:
"Fetch and untar"
,
chart
:
"test/signtest"
,
chart
:
"test/signtest"
,
flags
:
[]
string
{
"--
verify"
,
"--keyring"
,
"testdata/helm-test-key.pub"
,
"--
untar"
,
"--untardir"
,
"signtest"
},
flags
:
[]
string
{
"--untar"
,
"--untardir"
,
"signtest"
},
expectFile
:
"./signtest"
,
expectFile
:
"./signtest"
,
expectDir
:
true
,
expectDir
:
true
,
},
},
{
{
name
:
"Fetch, verify, untar"
,
name
:
"Fetch, verify, untar"
,
chart
:
"test/signtest"
,
chart
:
"test/signtest"
,
flags
:
[]
string
{
"--verify"
,
"--keyring"
,
"testdata/helm-test-key.pub"
,
"--untar"
,
"--untardir"
,
"signtest"
},
flags
:
[]
string
{
"--verify"
,
"--keyring"
,
"testdata/helm-test-key.pub"
,
"--untar"
,
"--untardir"
,
"signtest"
},
expectFile
:
"./signtest"
,
expectFile
:
"./signtest"
,
expectDir
:
true
,
expectDir
:
true
,
expectVerify
:
true
,
},
},
}
}
...
@@ -126,6 +131,15 @@ func TestFetchCmd(t *testing.T) {
...
@@ -126,6 +131,15 @@ func TestFetchCmd(t *testing.T) {
t
.
Errorf
(
"%q reported error: %s"
,
tt
.
name
,
err
)
t
.
Errorf
(
"%q reported error: %s"
,
tt
.
name
,
err
)
continue
continue
}
}
if
tt
.
expectVerify
{
pointerAddressPattern
:=
"0[xX][A-Fa-f0-9]+"
sha256Pattern
:=
"[A-Fa-f0-9]{64}"
verificationRegex
:=
regexp
.
MustCompile
(
fmt
.
Sprintf
(
"Verification: &{%s sha256:%s signtest-0.1.0.tgz}
\n
"
,
pointerAddressPattern
,
sha256Pattern
))
if
!
verificationRegex
.
MatchString
(
buf
.
String
())
{
t
.
Errorf
(
"%q: expected match for regex %s, got %s"
,
tt
.
name
,
verificationRegex
,
buf
.
String
())
}
}
ef
:=
filepath
.
Join
(
outdir
,
tt
.
expectFile
)
ef
:=
filepath
.
Join
(
outdir
,
tt
.
expectFile
)
fi
,
err
:=
os
.
Stat
(
ef
)
fi
,
err
:=
os
.
Stat
(
ef
)
...
...
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