mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Add annotations to routes and apps (#866)
Adds 'annotations' attribute to Routes and Apps
This commit is contained in:
29
test/fn-api-tests/config_cases.go
Normal file
29
test/fn-api-tests/config_cases.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user