Files
fn-serverless/test/fn-api-tests/config_cases.go
Owen Cliffe d25b5af59d Add annotations to routes and apps (#866)
Adds 'annotations' attribute to Routes and Apps
2018-03-20 18:02:49 +00:00

30 lines
1.0 KiB
Go

package tests
import "reflect"
// common test cases around config for apps/routes
var updateConfigCases = []struct {
name string
intialConfig map[string]string
change map[string]string
expected map[string]string
}{
{"preserve existing config keys with nop", map[string]string{"key": "value1"}, map[string]string{}, map[string]string{"key": "value1"}},
{"preserve existing config keys with change", map[string]string{"key": "value1"}, map[string]string{"key": "value1"}, map[string]string{"key": "value1"}},
{"overwrite existing config keys", map[string]string{"key": "value1"}, map[string]string{"key": "value2"}, map[string]string{"key": "value2"}},
{"delete config key", map[string]string{"key": "value1"}, map[string]string{"key": ""}, map[string]string{}},
}
//ConfigEquivalent checks if two config objects are semantically equivalent (including nils)
func ConfigEquivalent(a map[string]string, b map[string]string) bool {
if len(a) == 0 && len(b) == 0 {
return true
}
return reflect.DeepEqual(a, b)
}