From 66410e617663dc18897c80700c1c4a2e4cb3d84c Mon Sep 17 00:00:00 2001 From: Jingyuan Liang Date: Fri, 14 Feb 2025 21:42:19 +0000 Subject: [PATCH] Add test case for escaped resyncInterval --- cmd/ip-masq-agent/ip-masq-agent_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/ip-masq-agent/ip-masq-agent_test.go b/cmd/ip-masq-agent/ip-masq-agent_test.go index a5751ad..39318f1 100644 --- a/cmd/ip-masq-agent/ip-masq-agent_test.go +++ b/cmd/ip-masq-agent/ip-masq-agent_test.go @@ -264,6 +264,18 @@ resyncInterval: 5m MasqLinkLocal: true, ResyncInterval: NewMasqConfigNoReservedRanges().ResyncInterval}}, + // There is custom unmarshaller here so check its behavior. + {"valid json file, just resyncInterval but escaped", fakefs.StringFS{File: ` +{ + "resyncInterval": "\u0035\u006d" +} +`}, + nil, &MasqConfig{ + CidrLimit: 64, + NonMasqueradeCIDRs: NewMasqConfigNoReservedRanges().NonMasqueradeCIDRs, + MasqLinkLocal: NewMasqConfigNoReservedRanges().MasqLinkLocal, + ResyncInterval: metav1.Duration{Duration: 5 * time.Minute}}}, + {"valid json file, just resyncInterval", fakefs.StringFS{File: ` { "resyncInterval": "5m"