Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AV-218868: Fix common failing unit tests #1541

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

AV-218868: Fix common failing unit tests #1541

wants to merge 7 commits into from

Conversation

ashishnayak96
Copy link
Contributor

No description provided.

@Dhivyaaj
Copy link

No JIRA Ids found for the PR. Jira id is mandatory to update fix version in jira. Please update respective Jira id in PR title or commit message if the PR is intented for default branches of repo. For mandatory exemptions, comment trigger phrase 'skip jira-id-check' in PR. For manual trigger, comment trigger phrase 'run jira-id-check' in PR.

@ashishnayak96
Copy link
Contributor Author

build ako

@ashishnayak96
Copy link
Contributor Author

build ako

@ashishnayak96
Copy link
Contributor Author

build ako

@ashishnayak96
Copy link
Contributor Author

Common tests failing fixed till now:

TestFQDNsCountForAviInfraSettingWithLargeShardSize
TestCreateHostRuleBeforeIngress
TestCreateUpdateDeleteL7RuleInHostRule

@ashishnayak96
Copy link
Contributor Author

build ako

1 similar comment
@pkoshtavmware
Copy link
Contributor

build ako

@@ -51,7 +54,7 @@ func UpdateHostRuleStatus(key string, hr *akov1beta1.HostRule, updateStatus Upda
"status": akov1beta1.HostRuleStatus(updateStatus),
})

_, err := lib.AKOControlConfig().V1beta1CRDClientset().AkoV1beta1().HostRules(hr.Namespace).Patch(context.TODO(), hr.Name, types.MergePatchType, patchPayload, metav1.PatchOptions{}, "status")
hrFromK8sClient, err := lib.AKOControlConfig().V1beta1CRDClientset().AkoV1beta1().HostRules(hr.Namespace).Patch(context.TODO(), hr.Name, types.MergePatchType, patchPayload, metav1.PatchOptions{}, "status")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initial comment: why are we retrying here as we are fetching from directly clientset so we should have updated content?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are doing a patch through clientset which returns the updated result but we are not sure if the crd informer is also updated with the changes. So here, we are waiting for the informer to be updated with the patch

@ashishnayak96
Copy link
Contributor Author

build ako

8 similar comments
@aaha97
Copy link
Contributor

aaha97 commented Sep 24, 2024

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@jeyapradeen-avi
Copy link
Contributor

build ako

@Dhivyaaj
Copy link

No JIRA Ids found for the PR. Jira id is mandatory to update fix version in jira. Please update respective Jira id in PR title or commit message if the PR is intented for default branches of repo. For mandatory exemptions, comment trigger phrase 'skip jira-id-check' in PR. For manual trigger, comment trigger phrase 'run jira-id-check' in PR.

@ashishnayak96
Copy link
Contributor Author

build ako

@ashishnayak96 ashishnayak96 changed the title Fix Unit tests AV-218868: Fix common failing unit tests Sep 25, 2024
@ashishnayak96
Copy link
Contributor Author

build ako

Comment on lines -364 to -367

.PHONY: multi_tenancy
multi_tenancy:
make -j 1 multitenancytests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this target?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is redundant to multitenancytests target

g := gomega.NewGomegaWithT(t)
g.Eventually(func() error {
ingClass, err := utils.GetInformers().IngressClassInformer.Lister().Get(ingclassName)
utils.AviLog.Infof("got ingclass %v", ingClass)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this log should be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolved

@ashishnayak96
Copy link
Contributor Author

build ako

@@ -64,6 +67,25 @@ func UpdateHostRuleStatus(key string, hr *akov1beta1.HostRule, updateStatus Upda
}
UpdateHostRuleStatus(key, updatedHr, updateStatus, retry+1)
}
// wait for crdinformer to be updated
constantBackoff := backoff.WithMaxRetries(backoff.NewConstantBackOff(500*time.Millisecond), 5)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being used in main processing path. It will impact each and every status update. Can it be optimized or moved to some other place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will only be impacted if it fails for the first time. We will wait for 500ms only when it is not updated. Best case is 0 ms. Worst case is 2.5s

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this being done to make sure that informer cache is populated before AKO uses hostrule in graph layer, did we see any issue related to this and if that's the case why aren't we doing the same for other CRs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed, we will take for other CRs separately

@akshayhavile
Copy link
Contributor

build ako

akshayhavile
akshayhavile previously approved these changes Oct 11, 2024
Copy link
Contributor

@akshayhavile akshayhavile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Need to re-run multiple times to verify its working fine.

@ashishnayak96
Copy link
Contributor Author

build ako

@ashishnayak96
Copy link
Contributor Author

build ako

1 similar comment
@ashishnayak96
Copy link
Contributor Author

build ako

err = backoff.Retry(operation, constantBackoff)
if err != nil {
utils.AviLog.Errorf("key: %s, msg: Hostrule %s/%s lister cache not updated with patch. error: [%s]", key, hr.Namespace, hr.Name, err.Error())
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a return or the success message gets printed as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

informer cache is internal for us, the kubernetes object has already been patched so successful message is also necessary

@@ -485,7 +485,7 @@ func TestFQDNsCountForAviInfraSettingWithDedicatedShardSize(t *testing.T) {
g.Eventually(func() bool {
_, found := mcache.VsCacheMeta.AviCacheGet(vsKey)
return found
}, 50*time.Second).Should(gomega.Equal(false))
}, 50*time.Second, 5*time.Second).Should(gomega.Equal(false))
Copy link
Contributor

@abhishekbsingh abhishekbsingh Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we increasing the polling period from 10 ms to 5 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to decrease the load on cpu

@ashishnayak96
Copy link
Contributor Author

build ako

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants