func TestSource(t *testing.T) {
	// t.Parallel()
	clients := test.Setup(t)

	// create vcsim
	cleanupVcsim := CreateSimulator(t, clients)
	defer cleanupVcsim()

	// Create a job/svc that listens for events and then quits N seconds after the first is received.
	name, wait, cancelListener := RunJobListener(t, clients)
	defer cancelListener()

	// Create a source that emits events from the vcsim.
	cancelSource := CreateSource(t, clients, name)
	defer cancelSource()

	// trigger events
	selector, cancelTrigger := CreateJobBinding(t, clients)
	defer cancelTrigger()

	script := strings.Join([]string{
		"export GOVC_URL=$VC_URL",
		"export GOVC_INSECURE=$VC_INSECURE",
		"export GOVC_USERNAME=$VC_USERNAME",
		"export GOVC_PASSWORD=$VC_PASSWORD",
		"sleep 5",
		"govc vm.power -off /DC0/vm/DC0_H0_VM0 && sleep 3",
		"govc vm.power -off /DC0/vm/DC0_H0_VM1 && sleep 3",
	}, "\n")

	// Run a simple script as a Job on the cluster.
	RunBashJob(t, clients, pkgtest.ImagePath("govc"), script, selector)

	// Wait for the job to complete, and then cleanup.
	wait()
}
// TestSource creates a Job that completes after receiving events, and a Source targeting that job.
TestSource creates a Job that completes after receiving events, and a Source targeting that job.
// TestSource creates a Job that completes after receiving events and a Source targeting that job .
func TestSource(t *testing.T) {
	clients := test.Setup(t)
	cleanupVcsim := CreateSimulator(t, clients)
	defer cleanupVcsim()
	name, wait, cancelListener := RunJobListener(t, clients)
	defer cancelListener()
	cancelSource := CreateSource(t, clients, name)
	defer cancelSource()
	selector, cancelTrigger := CreateJobBinding(t, clients)
	defer cancelTrigger()
	script := strings.Join([]string{
		"export GOVC_URL=$VC_URL",
		"export GOVC_INSECURE=$VC_INSECURE",
		"export GOVC_USERNAME=$VC_USERNAME",
		"export GOVC_PASSWORD=$VC_PASSWORD",
		"sleep 5",
		"govc vm.power -off /DC0/vm/DC0_H0_VM0 && sleep 3",
		"govc vm.power -off /DC0/vm/DC0_H0_VM1 && sleep 3",
	}, "\n")
	RunBashJob(t, clients, pkgtest.ImagePath("govc"), script, selector)
	wait()
}
func TestSource ( t * testing . T ) { clients := test . Setup ( t ) cleanupVcsim := CreateSimulator ( t , clients ) defer cleanupVcsim ( ) name , wait , cancelListener := RunJobListener ( t , clients ) defer cancelListener ( ) cancelSource := CreateSource ( t , clients , name ) defer cancelSource ( ) selector , cancelTrigger := CreateJobBinding ( t , clients ) defer cancelTrigger ( ) script := strings . Join ( [ ] string { " " , " " , " " , " " , " " , " " , " " , } , " \n " ) RunBashJob ( t , clients , pkgtest . ImagePath ( " " ) , script , selector ) wait ( ) }
TestSource creates a Job that completes after receiving events, and a Source targeting that job.
TestSource creates a Job that completes after receiving events and a Source targeting that job .
// t.Parallel() // create vcsim // Create a job/svc that listens for events and then quits N seconds after the first is received. // Create a source that emits events from the vcsim. // trigger events // Run a simple script as a Job on the cluster. // Wait for the job to complete, and then cleanup.