Files
Packer-Cn/packer/cmd_hook_test.go
hashicorp-copywrite[bot] b7df3ca36f [COMPLIANCE] Add Copyright and License Headers (#12254)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-03-02 15:37:05 -05:00

30 lines
531 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package packer
import (
"os/exec"
"testing"
)
func TestHook_NoExist(t *testing.T) {
c := NewClient(&PluginClientConfig{Cmd: exec.Command("i-should-not-exist")})
defer c.Kill()
_, err := c.Hook()
if err == nil {
t.Fatal("should have error")
}
}
func TestHook_Good(t *testing.T) {
c := NewClient(&PluginClientConfig{Cmd: helperProcess("hook")})
defer c.Kill()
_, err := c.Hook()
if err != nil {
t.Fatalf("should not have error: %s", err)
}
}