Unit tests for enableFeaturesFromFlags function (#6063)
* - exporting BoolPairs CLI func - added tests for enableFeaturesFromFlags function * Add a test that uses a feature flag to add change the outcome of code - and test persistence, as that's the current implementation Signed-off-by: Sven Dowideit <sven.dowideit@portainer.io> * Minor comment updates Co-authored-by: Sven Dowideit <sven.dowideit@portainer.io> Co-authored-by: Stéphane Busso <stephane.busso@gmail.com>
This commit is contained in:
@@ -36,7 +36,7 @@ func (*Service) ParseFlags(version string) (*portainer.CLIFlags, error) {
|
||||
Assets: kingpin.Flag("assets", "Path to the assets").Default(defaultAssetsDirectory).Short('a').String(),
|
||||
Data: kingpin.Flag("data", "Path to the folder where the data is stored").Default(defaultDataDirectory).Short('d').String(),
|
||||
EndpointURL: kingpin.Flag("host", "Environment URL").Short('H').String(),
|
||||
FeatureFlags: boolPairs(kingpin.Flag("feat", "List of feature flags").Hidden()),
|
||||
FeatureFlags: BoolPairs(kingpin.Flag("feat", "List of feature flags").Hidden()),
|
||||
EnableEdgeComputeFeatures: kingpin.Flag("edge-compute", "Enable Edge Compute features").Bool(),
|
||||
NoAnalytics: kingpin.Flag("no-analytics", "Disable Analytics in app (deprecated)").Bool(),
|
||||
TLS: kingpin.Flag("tlsverify", "TLS support").Default(defaultTLS).Bool(),
|
||||
|
||||
@@ -38,7 +38,7 @@ func (l *pairListBool) IsCumulative() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func boolPairs(s kingpin.Settings) (target *[]portainer.Pair) {
|
||||
func BoolPairs(s kingpin.Settings) (target *[]portainer.Pair) {
|
||||
target = new([]portainer.Pair)
|
||||
s.SetValue((*pairListBool)(target))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user