Hi! I am a final year undergrad from Delhi, India. I have started working on an issue related to mesheryctl but am facing some decision issues (related to approaches) and thus am here looking for a meshmate to help me get a better understanding of codebase and help me point to the right people and further contributions I can make.
I am a newbie to open source but I do have prior development experience (MERN Stack, Java and SQL). I am looking forward to make contribution to mesheryctl and also learn golang and cloud native technologies in the process!
Hi @Riya Welcome to Layer ! I’d be happy to help you! Meshery’s community thrives on collaboration, and MeshMates are here to guide contributors like you. Let’s connect and go over the specifics of your issue. to better assist you, it’d be helpful to understand the issue you’re tackling with mesheryctl. Share the approaches you’ve considered so far and any challenges you’re facing. This will allow us to refine or suggest alternatives.
But, before I would recommend the following:
Start by exploring the mesheryctl repository and reading through the documentation and contributing guidelines.
Identify related files and modules to your issue.
This project might seem overwhelming at first, but the folks and meshmates are here to help you get started.
Thanks for your response. I am working on - issues#12135 : unit tests for generate relationships command (generates relationships data from a google spreadsheet)
I have done the following suggested work - went through mesheryctl repo, files, contribution guidelines and identified exactly what files I need to create.
Where would it be comfortable for you to discuss the approaches? shall I explain my problem/approaches I have tried here on forum or on slack?
@Riya, it would be awesome if you could share your approach here. That way, others can chime in and offer suggestions or alternative approaches to help refine your solution.
It is suggested in the issue (#12135) that Google API should be mocked for the tests, but I can’t find a suitable way of doing so. Here’s all what I have tried -
Mocking the whole google sheets interface - We can create mocks of all functions and structs using testify mock. But since the google sheet api is a bit complex in structure, moreover, the output of these mock functions aren’t being processed at all (the code just checks if the output from a certain google sheet api package function is nil or valid). Considering these, I feel writing such big mocks won’t be of much use.
httpmock: It doesn’t work as the source code expects the object *http.Transport at a lot of places and httpmock returns *httpmock.MockTransport
httptest - It is compatible with *http.Transport, but this doesn’t intercept the mentioned url requests unlike httpmock, we’ll have to make an explicit call to the mockserver, which is not possible again in tests because when we execute the command, the call to endpoint is embedded deep into the main call (in other words, it goes through many other function calls before we hit the endpoint)
Considering all these, I feel I can write unit test to only test the main logic of the command which is - createjson function and not the entire command. Can someone please guide if I am thinking in the correct way or am I missing something?