You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
terraform/internal/backend/remote-state/inmem/testing.go

35 lines
635 B

// Copyright IBM Corp. 2014, 2026
// SPDX-License-Identifier: BUSL-1.1
package inmem
import (
"testing"
statespkg "github.com/hashicorp/terraform/internal/states"
)
func ReadState(t *testing.T, wsName string) *statespkg.State {
states.Lock()
defer states.Unlock()
stateMgr, ok := states.m[wsName]
if !ok {
t.Fatalf("state not found for workspace %s", wsName)
}
return stateMgr.State()
}
func ReadWorkspaces(t *testing.T) []string {
states.Lock()
defer states.Unlock()
workspaces := make([]string, 0, len(states.m))
for wsName := range states.m {
workspaces = append(workspaces, wsName)
}
return workspaces
}