Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
2d92fd87
Commit
2d92fd87
authored
Jun 18, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test case for gzip that expands the data and compares to what we put in
parent
801e5aaa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
post-processor/compress/post-processor_test.go
post-processor/compress/post-processor_test.go
+11
-4
No files found.
post-processor/compress/post-processor_test.go
View file @
2d92fd87
package
compress
package
compress
import
(
import
(
"compress/gzip"
"fmt"
"fmt"
"io/ioutil"
"os"
"os"
"strings"
"strings"
"testing"
"testing"
...
@@ -54,6 +56,8 @@ func TestDetectFilename(t *testing.T) {
...
@@ -54,6 +56,8 @@ func TestDetectFilename(t *testing.T) {
}
}
}
}
const
expectedFileContents
=
"Hello world!"
func
TestSimpleCompress
(
t
*
testing
.
T
)
{
func
TestSimpleCompress
(
t
*
testing
.
T
)
{
const
config
=
`
const
config
=
`
{
{
...
@@ -137,10 +141,13 @@ func TestCompressOptions(t *testing.T) {
...
@@ -137,10 +141,13 @@ func TestCompressOptions(t *testing.T) {
artifact
:=
testArchive
(
t
,
config
)
artifact
:=
testArchive
(
t
,
config
)
defer
artifact
.
Destroy
()
defer
artifact
.
Destroy
()
// Verify things look good
filename
:=
"package.gz"
_
,
err
:=
os
.
Stat
(
"package.gz"
)
archive
,
_
:=
os
.
Open
(
filename
)
if
err
!=
nil
{
gzipReader
,
_
:=
gzip
.
NewReader
(
archive
)
t
.
Errorf
(
"Unable to read archive: %s"
,
err
)
data
,
_
:=
ioutil
.
ReadAll
(
gzipReader
)
if
string
(
data
)
!=
expectedFileContents
{
t
.
Errorf
(
"Expected:
\n
%s
\n
Found:
\n
%s
\n
"
,
expectedFileContents
,
data
)
}
}
}
}
...
...
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