Skip to content

Conversation

@gaurab-khanal
Copy link
Member

Description

This PR adds test cases for discovery.go.

@gaurab-khanal
Copy link
Member Author

@Rupam-It I got one error here for TestBuildClusterClient.

--- FAIL: TestBuildClusterClient (0.00s)
    --- FAIL: TestBuildClusterClient/exists_kubeconfig_and_context_override_wds1 (0.00s)
        discovery_test.go:200: Expected ctxName to be "wds1", but got "test-context"
        discovery_test.go:203: Expected clusterName to be "wds1-cluster", but got "test-cluster"

It seems like

ctxName := rawCfg.CurrentContext 

doesn't returns override context.

Reference: https://github.com/kubestellar/kubectl-plugin/blob/main/pkg/cluster/discovery.go#L136

Can't we just return overrides.CurrentContext as the ctxName.
Reference: https://github.com/kubestellar/kubectl-plugin/blob/main/pkg/cluster/discovery.go#L102C3-L102C27

@gaurab-khanal
Copy link
Member Author

@Rupam-It Any updates for this?

Copy link
Contributor

@Rupam-It Rupam-It left a comment

Choose a reason for hiding this comment

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

Hii @gaurab-khanal can you please describe what the problem with ctx?

@gaurab-khanal
Copy link
Member Author

@Rupam-It
Copy link
Contributor

Rupam-It commented Nov 3, 2025

@gaurab-khanal Now I understand the problem ! Did you think any solution of this problem ?

@gaurab-khanal
Copy link
Member Author

@Rupam-It
Copy link
Contributor

Rupam-It commented Nov 4, 2025

I'm not sue about this !
I have to do research about it and if you done any research on this please go ahead!
check that if your proposed solution is working or not!

@rishi-jat
Copy link
Member

@gaurab-khanal is the issue you were facing is fixed ?

@gaurab-khanal
Copy link
Member Author

gaurab-khanal commented Nov 5, 2025

@Rupam-It here current context is returned instead of override context. https://github.com/kubestellar/kubectl-plugin/blob/main/pkg/cluster/discovery.go#L136

In test file, we have current context as test-context but here in this test case I have override the context to wds1 but the function is returning current context which is test-context.
So in this file at 1st check if context override is provided or not. If provided return ctxName as overridecontext else return current context.

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