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

[Feature][kubectl-plugin] e2e test for 'kubectl ray log' #2486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chiayi
Copy link
Contributor

@chiayi chiayi commented Oct 31, 2024

Why are these changes needed?

This adds e2e test for kubectl ray log.

Related issue number

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Expect(strings.TrimSpace(string(output))).Should(MatchRegexp(expectedOutputStringFormat))

// Check that the log directory exists
logDirInfo, err := os.Stat(expectedDirPath)
Copy link
Contributor Author

@chiayi chiayi Oct 31, 2024

Choose a reason for hiding this comment

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

@andrewsykim are there files that you think we should check that is for sure retrieved? Eg stdout.log

Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be good to check the contents of some log files that exist in every standard Ray cluster

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 checks for "stdout.log" and "raylet.out" and a specific log content. PTAL!

@chiayi chiayi force-pushed the kubectl-plugin branch 3 times, most recently from 3d02506 to 9fc0313 Compare October 31, 2024 20:48
@chiayi chiayi force-pushed the kubectl-plugin branch 3 times, most recently from 1c1d121 to fb97861 Compare November 9, 2024 00:19

var _ = Describe("Calling ray plugin `log` command on Ray Cluster", Ordered, func() {
It("succeed in retrieving all ray cluster logs", func() {
expectedDirPath := "./raycluster-sample"
Copy link
Member

Choose a reason for hiding this comment

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

Should we first change current directory into a temp folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A new directory is created for the raycluster and all the necessary logs should stay in there so I don't think there's a need to create a temp folder. Would creating a temp folder be safer/easier for cleanup? WDYT?

Copy link
Member

@MortalHappiness MortalHappiness Nov 18, 2024

Choose a reason for hiding this comment

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

I think it would be eaiser for cleanup. You only need to delete one folder at the end of the tests instead of using an AfterEach block.

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 would still need to do a cleanup after each 'It' block right? Since we want to make sure previous downloaded log files don't effect proceeding calls.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm. Actually I originally thought that some It didn't create folders, but you still executed os.RemoveAll.

kubectl-plugin/test/e2e/kubectl_ray_log_test.go Outdated Show resolved Hide resolved
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