mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-19 06:21:41 -04:00
* [COMPLIANCE] Add/Update Copyright Headers * make generate update * make generate --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com> Co-authored-by: sanya <[email protected]> Co-authored-by: Sanya <[email protected]>
30 lines
563 B
Go
30 lines
563 B
Go
// Copyright IBM Corp. 2024, 2026
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package packer
|
|
|
|
import (
|
|
"os/exec"
|
|
"testing"
|
|
)
|
|
|
|
func TestDatasource_NoExist(t *testing.T) {
|
|
c := NewClient(&PluginClientConfig{Cmd: exec.Command("i-should-not-exist")})
|
|
defer c.Kill()
|
|
|
|
_, err := c.Datasource()
|
|
if err == nil {
|
|
t.Fatal("should have error")
|
|
}
|
|
}
|
|
|
|
func TestDatasource_Good(t *testing.T) {
|
|
c := NewClient(&PluginClientConfig{Cmd: helperProcess("datasource")})
|
|
defer c.Kill()
|
|
|
|
_, err := c.Datasource()
|
|
if err != nil {
|
|
t.Fatalf("should not have error: %s", err)
|
|
}
|
|
}
|