mirror of
https://github.com/hashicorp/packer.git
synced 2026-02-22 09:20:22 -05:00
docker-import + docker-push: Add some beginning tests. #774
This commit is contained in:
parent
637fa38286
commit
358b0078c9
3 changed files with 62 additions and 2 deletions
|
|
@ -67,8 +67,6 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
|||
id := artifact.Id()
|
||||
ui.Say("Importing image: " + id)
|
||||
|
||||
// TODO Set artifact ID so that docker-push can use it
|
||||
|
||||
if p.config.Tag == "" {
|
||||
|
||||
cmd := exec.Command("docker",
|
||||
|
|
|
|||
31
post-processor/docker-import/post-processor_test.go
Normal file
31
post-processor/docker-import/post-processor_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package dockerimport
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testConfig() map[string]interface{} {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
|
||||
func testPP(t *testing.T) *PostProcessor {
|
||||
var p PostProcessor
|
||||
if err := p.Configure(testConfig()); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
return &p
|
||||
}
|
||||
|
||||
func testUi() *packer.BasicUi {
|
||||
return &packer.BasicUi{
|
||||
Reader: new(bytes.Buffer),
|
||||
Writer: new(bytes.Buffer),
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
31
post-processor/docker-push/post-processor_test.go
Normal file
31
post-processor/docker-push/post-processor_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package dockerpush
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testConfig() map[string]interface{} {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
|
||||
func testPP(t *testing.T) *PostProcessor {
|
||||
var p PostProcessor
|
||||
if err := p.Configure(testConfig()); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
return &p
|
||||
}
|
||||
|
||||
func testUi() *packer.BasicUi {
|
||||
return &packer.BasicUi{
|
||||
Reader: new(bytes.Buffer),
|
||||
Writer: new(bytes.Buffer),
|
||||
}
|
||||
}
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
Loading…
Reference in a new issue