frameworkacctest

package
v1.83.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package frameworkacctest provides ProtoV5ProviderFactories used by framework resource / data source acceptance tests.

Design notes:

  • It reuses the same SDKv2 `tcprovider.Provider()` and the framework provider produced by `framework.NewProvider(primary)`, merged via tf5muxserver, so the test-time provider server is identical to the production one.
  • Existing SDKv2 tests keep using `tcacctest.AccProviders`; this factory only serves the newly added framework resource / data source tests.
  • The shared `AccPreCheck` and other SDKv2-side helpers stay under `tencentcloud/acctest/`. Framework tests therefore import both `tcacctest` (for PreCheck / test_util) and `tcfwacctest` (this package, providing the ProtoV5 factory).

Index

Constants

This section is empty.

Variables

View Source
var AccProtoV5ProviderFactories = map[string]func() (tfprotov5.ProviderServer, error){
	"tencentcloud": func() (tfprotov5.ProviderServer, error) {
		primary := tcprovider.Provider()
		providers := []func() tfprotov5.ProviderServer{
			primary.GRPCProvider,
			providerserver.NewProtocol5(framework.NewProvider(primary)),
		}
		mux, err := tf5muxserver.NewMuxServer(context.Background(), providers...)
		if err != nil {
			return nil, err
		}
		return mux.ProviderServer(), nil
	},
}

AccProtoV5ProviderFactories is the ProtoV5ProviderFactories used by framework-side resource acceptance tests. Each invocation builds a fresh mux server, but the underlying SDKv2 and framework providers share the same process-level client injected via `sharedmeta.SetSharedMeta`, honouring the dual-stack architecture contract.

Usage:

resource.Test(t, resource.TestCase{
    PreCheck:                 func() { tcacctest.AccPreCheck(t) },
    ProtoV5ProviderFactories: tcfwacctest.AccProtoV5ProviderFactories,
    Steps: []resource.TestStep{ ... },
})

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL