mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
considering time difference less than 1 sec
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
parent
d45175f5be
commit
a886539899
2 changed files with 7 additions and 3 deletions
|
@ -42,7 +42,9 @@ func ProcessMetrics(newStr, e2ePolicyName string, e2eTime time.Time) bool {
|
|||
fmt.Println("timeInTimeFormat: ", timeInTimeFormat)
|
||||
|
||||
diff := e2eTime.Sub(timeInTimeFormat)
|
||||
if diff < 0 {
|
||||
fmt.Println("diff: ", diff)
|
||||
if diff < time.Second {
|
||||
fmt.Println("****** condition ******")
|
||||
if action == "created" {
|
||||
fmt.Println("************policy created**************")
|
||||
return true
|
||||
|
|
|
@ -330,14 +330,16 @@ func Test_Generate_NetworkPolicy(t *testing.T) {
|
|||
// ====================================
|
||||
// ======== Create Generate NetworkPolicy Policy =============
|
||||
By("Creating Generate NetworkPolicy Policy")
|
||||
timeBeforePolicyCreation := time.Now()
|
||||
// timeBeforePolicyCreation := time.Now()
|
||||
loc, _ := time.LoadLocation("UTC")
|
||||
timeBeforePolicyCreation := time.Now().In(loc)
|
||||
_, err = e2eClient.CreateNamespacedResourceYaml(clPolGVR, npPolNS, test.Data)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// ============================================
|
||||
|
||||
// check metrics
|
||||
policySyncBool := false
|
||||
e2e.GetWithRetry(time.Duration(1), 15, func() error {
|
||||
e2e.GetWithRetry(time.Duration(2), 10, func() error {
|
||||
metricsString := callMetrics()
|
||||
policySyncBool = commonE2E.ProcessMetrics(metricsString, test.PolicyName, timeBeforePolicyCreation)
|
||||
if policySyncBool == false {
|
||||
|
|
Loading…
Add table
Reference in a new issue