From 6242a3ff1b95eb8fc89931b11115ec9c06d08e96 Mon Sep 17 00:00:00 2001 From: "naman.gupta" Date: Mon, 3 Oct 2022 16:05:10 +0530 Subject: [PATCH] Fix patch apply changes Fixing typos error caused while applying patch Signed-off-by: naman.gupta Change-Id: I20c9d4e6c37de746195105d00b69cff03cb40c40 --- a1-go/pkg/resthooks/resthooks.go | 2 +- a1-go/pkg/resthooks/resthooks_test.go | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/a1-go/pkg/resthooks/resthooks.go b/a1-go/pkg/resthooks/resthooks.go index 2767bda..45c3928 100644 --- a/a1-go/pkg/resthooks/resthooks.go +++ b/a1-go/pkg/resthooks/resthooks.go @@ -213,7 +213,7 @@ func toStringKeys(val interface{}) (interface{}, error) { } } -var validate(httpBodyString string, schemaString string) bool { +func validate(httpBodyString string, schemaString string) bool { var m interface{} err := yaml.Unmarshal([]byte(httpBodyString), &m) if err != nil { diff --git a/a1-go/pkg/resthooks/resthooks_test.go b/a1-go/pkg/resthooks/resthooks_test.go index 3afbb8e..da062aa 100644 --- a/a1-go/pkg/resthooks/resthooks_test.go +++ b/a1-go/pkg/resthooks/resthooks_test.go @@ -158,7 +158,7 @@ func TestGetPolicyInstance(t *testing.T) { "blocking_rate":20, "trigger_threshold":10 }` - instancekey := a1PolicyPrefix + strconv.FormatInt(20001, 10) + "." + string(policyInstanceID) + instancekey := a1InstancePrefix + strconv.FormatInt(20001, 10) + "." + string(policyInstanceID) a1.Logger.Debug("httpBody String : %+v", httpBody) a1.Logger.Debug("key : %+v", instancekey) var keys [1]string @@ -207,23 +207,15 @@ func (s *SdlMock) Get(ns string, keys []string) (map[string]interface{}, error) }` key = a1InstancePrefix + strconv.FormatInt(policytypeid, 10) + "." + string(policyInstanceID) } else if keys[0] == "a1.policy_type.20001" { - policySchemaString = `{"name":"admission_control_policy_mine", - "description":"various parameters to control admission of dual connection", - "policy_type_id": 20001, - "create_schema":{"$schema": "http://json-schema.org/draft-07/schema#","type": "object", - "properties": {"enforce": {"type": "boolean","default": "true"}, - "window_length": {"type":"integer","default": 1,"minimum": 1,"maximum": 60, - "description": "Sliding window length (in minutes)"}, - "blocking_rate": {"type": "number","default": 10,"minimum": 1,"maximum": 1001, - "description": "% Connections to block"}, - "additionalProperties": false}}}` + policySchemaString = `{"create_schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"additionalProperties":false,"blocking_rate":{"default":10,"description":"% Connections to block","maximum":1001,"minimum":1,"type":"number"},"enforce":{"default":"true","type":"boolean"},"window_length":{"default":1,"description":"Sliding window length (in minutes)","maximum":60,"minimum":1,"type":"integer"}},"type":"object"},"description":"various parameters to control admission of dual connection","name":"admission_control_policy_mine","policy_type_id":20001}` key = a1PolicyPrefix + strconv.FormatInt((policytypeid), 10) } a1.Logger.Error(" policy SchemaString %+v", policySchemaString) policyTypeSchema, _ := json.Marshal((policySchemaString)) a1.Logger.Error(" policyTypeSchema %+v", string(policyTypeSchema)) + a1.Logger.Error(" key for policy type %+v", key) - mp := map[string]interface{}{key: string(policyTypeSchema)} + mp := map[string]interface{}{key: string(policySchemaString)} a1.Logger.Error("Get Called and mp return %+v ", mp) return mp, nil } -- 2.16.6