Documentation
¶
Index ¶
Constants ¶
const TestUpstreamCommit = "test-upstream-commit-aabb1122"
TestUpstreamCommit is the default commit hash used by TestEnv.WriteDefaultLock and TestEnv.AddUpstreamComponent.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TestEnv ¶
type TestEnv struct {
Env *azldev.Env
Config *projectconfig.ProjectConfig
TestInterfaces azldev.SystemInterfaces
// Test implementations
CmdFactory *testctx.TestCmdFactory
DryRunnable opctx.DryRunnable
EventListener opctx.EventListener
TestFS opctx.FS
TestOSEnv opctx.OSEnv
CommandsExecuted [][]string
}
Test environment, useful for unit-testing azldev CLI commands. Contains an azldev.Env constructed with injected dependencies that redirect filesystem and OS environmental access to included test objects.
func (*TestEnv) AddUpstreamComponent ¶ added in v0.2.0
AddUpstreamComponent registers an upstream component in the test config and writes a minimal lock file so lock validation passes. Use this instead of setting env.Config.Components directly when the test doesn't need to customize the lock data.
func (*TestEnv) FS ¶
FS implements the opctx.FileSystemFactory interface.
func (*TestEnv) OSEnv ¶
FS implements the opctx.OSEnvFactory interface.
func (*TestEnv) WriteDefaultLock ¶ added in v0.2.0
WriteDefaultLock writes a minimal valid lock file for the named component. Use this when a test adds a component inline (with custom config) and just needs lock validation to pass.
func (*TestEnv) WriteLock ¶ added in v0.2.0
WriteLock creates a lock file on the test filesystem for the given component. Uses the same lock directory layout as the production lockfile.Store.