github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/internal/terraform/provisioner_mock_test.go (about)

     1  package terraform
     2  
     3  import (
     4  	"github.com/iaas-resource-provision/iaas-rpc/internal/provisioners"
     5  )
     6  
     7  // simpleMockProvisioner returns a MockProvisioner that is pre-configured
     8  // with schema for its own config, with the same content as returned by
     9  // function simpleTestSchema.
    10  //
    11  // For most reasonable uses the returned provisioner must be registered in a
    12  // componentFactory under the name "test". Use simpleMockComponentFactory
    13  // to obtain a pre-configured componentFactory containing the result of
    14  // this function along with simpleMockProvider, both registered as "test".
    15  //
    16  // The returned provisioner has no other behaviors by default, but the caller
    17  // may modify it in order to stub any other required functionality, or modify
    18  // the default schema stored in the field GetSchemaReturn. Each new call to
    19  // simpleTestProvisioner produces entirely new instances of all of the nested
    20  // objects so that callers can mutate without affecting mock objects.
    21  func simpleMockProvisioner() *MockProvisioner {
    22  	return &MockProvisioner{
    23  		GetSchemaResponse: provisioners.GetSchemaResponse{
    24  			Provisioner: simpleTestSchema(),
    25  		},
    26  	}
    27  }