2016-01-24 20:10:52 -06:00
|
|
|
package plugin
|
2014-10-04 11:11:51 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2016-01-24 20:10:52 -06:00
|
|
|
"github.com/hashicorp/go-plugin"
|
2014-10-04 11:11:51 -05:00
|
|
|
"github.com/hashicorp/terraform/terraform"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestUIOutput_impl(t *testing.T) {
|
|
|
|
var _ terraform.UIOutput = new(UIOutput)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestUIOutput_input(t *testing.T) {
|
2016-01-24 20:10:52 -06:00
|
|
|
client, server := plugin.TestRPCConn(t)
|
2014-10-04 11:11:51 -05:00
|
|
|
defer client.Close()
|
|
|
|
|
|
|
|
o := new(terraform.MockUIOutput)
|
|
|
|
|
2016-01-24 20:10:52 -06:00
|
|
|
err := server.RegisterName("Plugin", &UIOutputServer{
|
2014-10-04 11:11:51 -05:00
|
|
|
UIOutput: o,
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
|
|
|
|
2016-01-24 20:10:52 -06:00
|
|
|
output := &UIOutput{Client: client}
|
2014-10-04 11:11:51 -05:00
|
|
|
output.Output("foo")
|
|
|
|
if !o.OutputCalled {
|
|
|
|
t.Fatal("output should be called")
|
|
|
|
}
|
|
|
|
if o.OutputMessage != "foo" {
|
|
|
|
t.Fatalf("bad: %#v", o.OutputMessage)
|
|
|
|
}
|
|
|
|
}
|