github.com/opentofu/opentofu@v1.7.1/internal/tofu/provisioner_mock_test.go (about)

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