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

[YUNIKORN-2540] Deduplicate constants in pkg/cache/context_test.go #866

Closed
wants to merge 6 commits into from

Conversation

SophieTech88
Copy link
Contributor

@SophieTech88 SophieTech88 commented Jul 1, 2024

What is this PR for?

Constants are duplicated in the pkg/cache/context_test.go
Move to a central point of defining the constants for the test at the top of the file.
The related constant variables as below:

const (

Host1 = "host0001"
Host2 = "host0002"

appID1       = "app00001"
appID2       = "app00002"
appID3       = "app00003"
appID4       = "app00004"
appID5       = "app00005"
appIDUnknown = "app-none-exist"

uid1       = "uid_0001"
uid2       = "uid_0002"
uid3       = "uid_0003"
uid4       = "uid_0004"
uid5       = "uid_0005"
uidUnknown = "uid_0000"

pod1UID     = "task00001"
pod2UID     = "task00002"
taskUID1    = "task00001"
taskUID2    = "task00002"
taskUID3    = "task00003"
taskUID4    = "task00004"
taskUnknown = "non_existing_taskID"

podName1     = "pod1"
podName2     = "pod2"
podName3     = "pod3"
podName4     = "pod4"
podNamespace = "yk"

nodeName1    = "node1"
nodeName2    = "node2"
fakeNodeName = "fake-node"

queueNameA       = "root.a"
queueNameB       = "root.b"
queueNameC       = "root.c"
queueNameUnknown = "root.other"

annoAppID1 = "yunikorn-test-00001"
annoAppID2 = "yunikorn-test-00002"
annoAppID3 = "yunikorn-test-00003"
annoAppID4 = "yunikorn-test-00004"
annoAppID5 = "yunikorn-test-00005"

APIVersion1 = "v1"
testUser    = "test-user"

)

What type of PR is it?

  • - Bug Fix
  • - Improvement
  • - Feature
  • - Documentation
  • - Hot Fix
  • - Refactoring

Todos

  • - Task

What is the Jira issue?

https://issues.apache.org/jira/browse/YUNIKORN-2540

How should this be tested?

It should pass all test cases.

Screenshots (if appropriate)

截屏2024-07-01 上午12 09 32

Questions:

  • - The licenses files need update.
  • - There is breaking changes for older versions.
  • - It needs documentation.

@pbacsko pbacsko self-requested a review July 1, 2024 15:05
Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.30%. Comparing base (18c9985) to head (0844cdb).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #866      +/-   ##
==========================================
- Coverage   67.38%   67.30%   -0.09%     
==========================================
  Files          70       70              
  Lines        7623     7625       +2     
==========================================
- Hits         5137     5132       -5     
- Misses       2268     2274       +6     
- Partials      218      219       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SophieTech88
Copy link
Contributor Author

SophieTech88 commented Jul 1, 2024

I made a e2e test locally, script as : "./scripts/run-e2e-tests.sh -a test -n yktest -v kindest/node:v1.28.0" or "./scripts/run-e2e-tests.sh -a test -n yktest -v kindest/node:v1.30.0", both failed with preemption.

截屏2024-07-01 下午6 28 03

check the error for preemption in detail:

截屏2024-07-01 下午2 07 54

@chenyulin0719 chenyulin0719 self-requested a review July 4, 2024 07:07
Copy link
Contributor

@chenyulin0719 chenyulin0719 left a comment

Choose a reason for hiding this comment

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

A minor suggestion.

pkg/cache/context_test.go Outdated Show resolved Hide resolved
@pbacsko pbacsko changed the title [YUNIKORN-2540]Deduplicate for the constants in pkg/cache/context_tes.go [YUNIKORN-2540] Deduplicate for the constants in pkg/cache/context_test.go Jul 4, 2024
pkg/cache/context_test.go Outdated Show resolved Hide resolved
pkg/cache/context_test.go Outdated Show resolved Hide resolved
pkg/cache/context_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@pbacsko pbacsko left a comment

Choose a reason for hiding this comment

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

Simplifications are possible and some consistency-related stuff. See comments.

@pbacsko
Copy link
Contributor

pbacsko commented Jul 4, 2024

@SophieTech88 please rebase your branch with master changes.

@pbacsko
Copy link
Contributor

pbacsko commented Jul 4, 2024

Actually never mind, I did myself so we can have a green build.

@pbacsko pbacsko changed the title [YUNIKORN-2540] Deduplicate for the constants in pkg/cache/context_test.go [YUNIKORN-2540] Deduplicate constants in pkg/cache/context_test.go Jul 4, 2024
@chenyulin0719 chenyulin0719 self-requested a review July 12, 2024 14:13
@SophieTech88
Copy link
Contributor Author

Actually never mind, I did myself so we can have a green build.

Many thanks for your help.

Copy link
Contributor

@chenyulin0719 chenyulin0719 left a comment

Choose a reason for hiding this comment

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

Thanks @SophieTech88 for the update. A few minor comments.

pkg/cache/context_test.go Outdated Show resolved Hide resolved
pkg/cache/context_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@chenyulin0719 chenyulin0719 left a comment

Choose a reason for hiding this comment

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

+1 LGTM, will merge it once E2E test pass.

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.

3 participants