github.com/jbronn/packer@v0.1.6-0.20140120165540-8a1364dbd817/builder/googlecompute/step_create_ssh_key_test.go (about)

     1  package googlecompute
     2  
     3  import (
     4  	"github.com/mitchellh/multistep"
     5  	"testing"
     6  )
     7  
     8  func TestStepCreateSSHKey_impl(t *testing.T) {
     9  	var _ multistep.Step = new(StepCreateSSHKey)
    10  }
    11  
    12  func TestStepCreateSSHKey(t *testing.T) {
    13  	state := testState(t)
    14  	step := new(StepCreateSSHKey)
    15  	defer step.Cleanup(state)
    16  
    17  	// run the step
    18  	if action := step.Run(state); action != multistep.ActionContinue {
    19  		t.Fatalf("bad action: %#v", action)
    20  	}
    21  
    22  	// Verify that we have a public/private key
    23  	if _, ok := state.GetOk("ssh_private_key"); !ok {
    24  		t.Fatal("should have key")
    25  	}
    26  	if _, ok := state.GetOk("ssh_public_key"); !ok {
    27  		t.Fatal("should have key")
    28  	}
    29  }