-
Notifications
You must be signed in to change notification settings - Fork 95
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
Added unit test for describe #521
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: ayushrakesh <[email protected]>
Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, please review the Layer5 Community Welcome Guide and sure to join the community Slack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contributing, why there are so many *.json files?
@Aisuko That's what I can't able to understand ,why this is so, I have tried by removing my cloned copy and cloning it again, but it didn't worked. Can you help? |
@ayushrakesh declare a |
@Philip-21 Sorry, but I can't understood what you said. Please can you explain once more? Test passed successfully by running make test. |
if tests pass successfully, then its fine. Use the |
Signed-off-by: ayushrakesh <[email protected]>
@Philip-21 Pr is revised. |
@Philip-21 Please review my Pr. |
} | ||
|
||
// DescribeWithMock allows injection of a custom DescriberFor function | ||
func DescribeWithMock(client KubeClient, options DescriberOptions, describerFor func(schema.GroupKind, *rest.Config) (describe.ResourceDescriber, bool)) (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Describe function
is almost re-defined (refer to the describe.go) except for the type of client
; hence, the test is of little to no value.
The test is testing the DescribeWithMock
instead of testing the Describe defined in describe.go
.
If the Describe
function changes, how will this test help validate its functioning?
// Create a temporary file to simulate test-generated files | ||
tempFile := filepath.Join(tempDir, "tempfile.txt") | ||
if err := os.WriteFile(tempFile, []byte("temporary content"), 0644); err != nil { | ||
t.Fatalf("Failed to write to temporary file: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the creation of a temp file drives the results of the tests?
Suppose describe
gives the correct o/p but fails to write to the file, does it mean Describe
function is breaking, I don't think so.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Checking in... it has been awhile since we've heard from you on this issue. Are you still working on it? Please let us know and please don't hesitate to contact a MeshMate or any other community member for assistance.
|
Added unit test for describe package in kubernetes via mock client
This PR fixes #287
Only added test for describe package, will soon add tests for expose and kompose
Signed commits