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

e2e: make demo pod logged only when failed running #1470

Merged
merged 4 commits into from
Aug 14, 2023

Conversation

hj-johannes-lee
Copy link
Contributor

fixes: #1252

test/e2e/gpu/gpu.go Outdated Show resolved Hide resolved
test/e2e/qat/qatplugin_dpdk.go Outdated Show resolved Hide resolved
test/e2e/gpu/gpu.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 26, 2023

Codecov Report

Merging #1470 (042be9d) into main (4c58a78) will not change coverage.
Report is 2 commits behind head on main.
The diff coverage is n/a.

❗ Current head 042be9d differs from pull request most recent head de0b4f6. Consider uploading reports for the commit de0b4f6 to get more accurate results

@@           Coverage Diff           @@
##             main    #1470   +/-   ##
=======================================
  Coverage   50.04%   50.04%           
=======================================
  Files          43       43           
  Lines        4884     4884           
=======================================
  Hits         2444     2444           
  Misses       2301     2301           
  Partials      139      139           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@hj-johannes-lee hj-johannes-lee force-pushed the PR-2023-021 branch 2 times, most recently from 8b2047a to 1301a0c Compare July 26, 2023 20:00
@hj-johannes-lee
Copy link
Contributor Author

hj-johannes-lee commented Jul 26, 2023

There are some parts that we did not put log printing after running a demo pod.

ginkgo.By("waiting the pod to finish successfully")
e2epod.NewPodClient(fmw).WaitForSuccess(ctx, pod.ObjectMeta.Name, 60*time.Second)
// If WaitForSuccess fails, ginkgo doesn't show the logs of the failed container.
// Replacing WaitForSuccess with WaitForFinish + 'kubelet logs' would show the logs
//fmw.PodClient().WaitForFinish(pod.ObjectMeta.Name, 60*time.Second)
//framework.RunKubectlOrDie(fmw.Namespace.Name, "logs", pod.ObjectMeta.Name)

ginkgo.It("deploys a crypto pod requesting QAT resources", func(ctx context.Context) {
ginkgo.By("submitting a crypto pod requesting QAT resources")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(cryptoTestYamlPath))
ginkgo.By("waiting the crypto pod to finish successfully")
e2epod.NewPodClient(f).WaitForSuccess(ctx, "qat-dpdk-test-crypto-perf-tc1", 60*time.Second)
})
ginkgo.It("deploys a compress pod requesting QAT resources", func(ctx context.Context) {
ginkgo.By("submitting a compress pod requesting QAT resources")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-k", filepath.Dir(compressTestYamlPath))
ginkgo.By("waiting the compress pod to finish successfully")
e2epod.NewPodClient(f).WaitForSuccess(ctx, "qat-dpdk-test-compress-perf-tc1", 60*time.Second)
})

ginkgo.By("waiting the pod to finish successfully")
e2epod.NewPodClient(f).WaitForSuccess(ctx, pod.ObjectMeta.Name, 60*time.Second)

Then, do we add it in this PR? Or was there any reason that we do not need to check the logs from those?

@hj-johannes-lee hj-johannes-lee marked this pull request as ready for review July 26, 2023 20:26
@mythi
Copy link
Contributor

mythi commented Jul 27, 2023

Then, do we add it in this PR? Or was there any reason that we do not need to check the logs from those?

No reason. In the past each e2e module was worked on independently by different individuals and that made the implementations to differ. I hope your work can make them to be more consistent.

If this PR plans to fix #1252, let's do that for all of the devices then and so that they work the same. Note that the ask for #1252 to not log output when there are no errors and only log when the sample app fails.

@hj-johannes-lee
Copy link
Contributor Author

No reason. In the past each e2e module was worked on independently by different individuals and that made the implementations to differ. I hope your work can make them to be more consistent.

I see. I felt that it would be good to have a common function for pod logging, then it would be consistent in any case. The function does: 1. check if the error is nil or not 2. if not nil, then prints logs 3 and then fail with the error

If this PR plans to fix #1252, let's do that for all of the devices then and so that they work the same. Note that the ask for #1252 to not log output when there are no errors and only log when the sample app fails.

Ok, with the function I made, we can also achieve that only when there are errors, logs are printed.

@hj-johannes-lee
Copy link
Contributor Author

Ready for review!

Copy link
Contributor

@tkatila tkatila left a comment

Choose a reason for hiding this comment

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

nitpick, can you squash commits into one or two? I don't think each device merits a separate commit.

Otherwise, looks good!

@hj-johannes-lee hj-johannes-lee changed the title e2e: add logging even when pod failed running e2e: add logging only when pod failed running Jul 31, 2023
test/e2e/utils/utils.go Outdated Show resolved Hide resolved
test/e2e/utils/utils.go Outdated Show resolved Hide resolved
test/e2e/utils/utils.go Outdated Show resolved Hide resolved
@hj-johannes-lee hj-johannes-lee force-pushed the PR-2023-021 branch 2 times, most recently from 88001ea to 75872c2 Compare August 2, 2023 14:22
test/e2e/utils/utils.go Outdated Show resolved Hide resolved
test/e2e/utils/utils.go Outdated Show resolved Hide resolved
@hj-johannes-lee
Copy link
Contributor Author

Idk why, but after changing to gomega way, linter govet (shadow the declaration of err earlier) complains a lot in many random places though there was no change there.

Actually in the first place when I changed the structure of e2e tests to have layers like Context() or BeforeEach(), we should have considered this matter.

But, anyway, I included in this PR in the first commit to prevent all the possible problems in the future.!

@hj-johannes-lee hj-johannes-lee changed the title e2e: add logging only when pod failed running e2e: make demo logged only when pod failed running Aug 2, 2023
@hj-johannes-lee hj-johannes-lee changed the title e2e: make demo logged only when pod failed running e2e: make demo pod logged only when pod failed running Aug 2, 2023
@hj-johannes-lee hj-johannes-lee changed the title e2e: make demo pod logged only when pod failed running e2e: make demo pod logged only when failed running Aug 2, 2023
mythi
mythi previously approved these changes Aug 3, 2023
@hj-johannes-lee
Copy link
Contributor Author

Something else to be chaged?

@mythi
Copy link
Contributor

mythi commented Aug 4, 2023

Something else to be chaged?

@tkatila needs to approve to unblock merging but e2e-* are also not healthy so we will want to get everything working again before merging

when err is declared and any parts below that declare again,
linter complains as follows:
shadow: declaration of err shadows declaration at line 51

so, we name the first declaration as errFailedToLocateRepoFile so
that other 'err's do not need to be named all in different names
or can be declared as 'err' without linter error.

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
tkatila
tkatila previously approved these changes Aug 7, 2023
tkatila
tkatila previously approved these changes Aug 8, 2023
this makes a demo pod's log get printed only when the pod
did not run sucessfully

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
@hj-johannes-lee
Copy link
Contributor Author

hj-johannes-lee commented Aug 8, 2023

@tkatila Sorry, could you approve again? I should have ran make lint before pushing.
@mythi maybe ready to merge?

@mythi
Copy link
Contributor

mythi commented Aug 11, 2023

@tkatila Sorry, could you approve again? I should have ran make lint before pushing. @mythi maybe ready to merge?

I'd propose we wait e2e-fpga back online since this is not urgent

@mythi mythi merged commit 1100a8f into intel:main Aug 14, 2023
68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

e2e: request to change current approach to get logs
4 participants