Documentation
¶
Overview ¶
Package testing provides integration test helpers for Deployah scenarios.
Scenario directories under scenarios/ hold sample specs, environment files, and expected Kubernetes output. DiscoverScenarios finds them automatically; IntegrationTestSuite loads a spec, generates a chart, renders templates, and compares results to golden files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TestScenariosDir = getTestScenariosDir()
TestScenariosDir is the directory containing integration test scenarios.
Functions ¶
This section is empty.
Types ¶
type IntegrationTestSuite ¶
type IntegrationTestSuite struct {
// ScenariosDir is the root directory of test scenarios.
ScenariosDir string
// OutputDir is the temporary workspace for a test run.
OutputDir string
}
IntegrationTestSuite runs scenario-based chart and manifest tests.
func NewIntegrationTestSuite ¶
func NewIntegrationTestSuite(t *testing.T) *IntegrationTestSuite
NewIntegrationTestSuite creates a suite rooted at TestScenariosDir.
func (*IntegrationTestSuite) RunScenarioTest ¶
func (suite *IntegrationTestSuite) RunScenarioTest(t *testing.T, scenario TestScenario)
RunScenarioTest executes a test for a specific scenario
type TestScenario ¶
type TestScenario struct {
// Name is the scenario directory name.
Name string
// ScenarioDir is the relative path under TestScenariosDir.
ScenarioDir string
// ManifestFile is the manifest filename within ScenarioDir.
ManifestFile string
// Environment selects the manifest environment for chart generation.
Environment string
// EnvFiles lists dotenv files to copy into the test workspace.
EnvFiles []string
// ExpectedDir is the golden output directory, relative to TestScenariosDir.
ExpectedDir string
// ExpectError requires manifest loading to fail.
ExpectError bool
// ExpectedErrors requires specific substrings in the load error message.
ExpectedErrors []string
}
TestScenario describes one integration test case under scenarios/.
func DiscoverScenarios ¶
func DiscoverScenarios(scenariosDir string) ([]TestScenario, error)
DiscoverScenarios discovers test scenarios from the directory structure.
func LoadScenario ¶
func LoadScenario(scenariosDir, scenarioName string) (*TestScenario, error)
LoadScenario loads a specific scenario by name
func LoadScenarioWithEnvironment ¶
func LoadScenarioWithEnvironment(scenariosDir, scenarioName, environment string) (*TestScenario, error)
LoadScenarioWithEnvironment loads a scenario with a specific environment