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

Mark readLogFile as a test helper function #39

Closed
farshidtz opened this issue Jan 29, 2024 · 2 comments
Closed

Mark readLogFile as a test helper function #39

farshidtz opened this issue Jan 29, 2024 · 2 comments
Labels
CI Continuous Integration enhancement New feature or request

Comments

@farshidtz
Copy link
Member

This could be marked as a helper function:

func readLogFile(t *testing.T, filePath string) (string, error) {
    t.Helper()
    text, err := os.ReadFile(filePath)
    if err != nil {
        return "", err
    }
    return string(text), nil
}

(then change the in the call of the function also to: logs, err := readLogFile(t, appLogPath) )

Originally posted by @locnnil in #36 (comment)

@farshidtz farshidtz added enhancement New feature or request CI Continuous Integration labels Jan 29, 2024
@farshidtz
Copy link
Member Author

farshidtz commented Jan 29, 2024

This function doesn't perform much. The os.ReadFile function can be called directly by waitForLogMessage. On the other hand, waitForLogMessage (the caller) could be marked as helper and moved to canonical/matter-snap-testing.

@farshidtz
Copy link
Member Author

The function has been removed in #45

More refactoring is needed, as suggested in the above comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant