Test for httptrigger and functions container/newdeploy (#2861)

* Test for httptrigger and functions
* Fixes with multierror
* review changes

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2023-10-27 15:05:20 +05:30
committed by GitHub
parent 2eb2eba88c
commit 2223081c80
24 changed files with 292 additions and 166 deletions
+10 -2
View File
@@ -21,11 +21,20 @@ import (
"fmt"
"os"
"go.uber.org/zap"
"sigs.k8s.io/yaml"
)
// GetFeatureConfig reads the configMap file and unmarshals the config into a feature config struct
func GetFeatureConfig() (*FeatureConfig, error) {
func GetFeatureConfig(logger *zap.Logger) (*FeatureConfig, error) {
featureConfig := &FeatureConfig{}
// check if the file exists
if _, err := os.Stat(FeatureConfigFile); os.IsNotExist(err) {
logger.Warn("using empty feature config as file not found", zap.String("configPath", FeatureConfigFile))
return featureConfig, nil
}
// read the file
b64EncodedContent, err := os.ReadFile(FeatureConfigFile)
if err != nil {
@@ -39,7 +48,6 @@ func GetFeatureConfig() (*FeatureConfig, error) {
}
// unmarshal into feature config
featureConfig := &FeatureConfig{}
err = yaml.Unmarshal(yamlContent, featureConfig)
if err != nil {
return nil, fmt.Errorf("error unmarshalling YAML config %v", err)