1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 05:19:39 +02:00

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:
zees-dev 2021-11-15 12:00:25 +13:00 committed by GitHub
parent 9e9a4ca4cc
commit 7d92aa1971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 117 additions and 3 deletions

View file

@ -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(),

View file

@ -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