Allow customization of product variables in a test fixture

Adds FixtureModifyProductVariables.

Bug: 181070625
Test: m nothing
Change-Id: Iad7e125ed722d99dc1e62479b04b625075b89d58
This commit is contained in:
Paul Duffin 2021-03-04 15:11:01 +00:00
parent bbccfcfb70
commit 2e0323dd1b
1 changed files with 13 additions and 0 deletions

View File

@ -313,6 +313,19 @@ func FixtureModifyEnv(mutator func(env map[string]string)) FixturePreparer {
}) })
} }
// Allow access to the product variables when preparing the fixture.
type FixtureProductVariables struct {
*productVariables
}
// Modify product variables.
func FixtureModifyProductVariables(mutator func(variables FixtureProductVariables)) FixturePreparer {
return FixtureModifyConfig(func(config Config) {
productVariables := FixtureProductVariables{&config.productVariables}
mutator(productVariables)
})
}
// GroupFixturePreparers creates a composite FixturePreparer that is equivalent to applying each of // GroupFixturePreparers creates a composite FixturePreparer that is equivalent to applying each of
// the supplied FixturePreparer instances in order. // the supplied FixturePreparer instances in order.
// //