feature: 355: snapshot with local file: run meshery without nats, output results into local file
…
Description
This PR implements #355
Continuation on https://github.com/meshery/meshsync/pull/364 and https://github.com/meshery/meshsync/pull/361
Notes for Reviewers
Was able to achieve Run meshsync without nats and output to file as json (instead of nats);
Import of result file into kanvas. ~~When I try to upload result file to kanvas -> it doesn't work, as kanvas expects file to be yml or yaml. Simple conversion in online editor from json to yaml didn't help, probably need to play a little with the format.~~
~~But If I take json of one resource (f.e. pod) andconvert it to yaml and import it to yaml -> it works.~~
~~So here need to output resource in the correct yaml list so that the output could be imported to kanvas directly.~~
Updated marshaling to yaml.
Signed commits
- [x] Yes, I signed my commits.
Yay, your first pull request! :thumbsup: 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. Be sure to double-check that you have signed your commits. Here are instructions for making signing an implicit activity while peforming a commit.
Hey hello, :wave: :innocent: !
Would appreciate if you @devhindo by chance have some comments on this :blush: thank you :bowing_woman:
Great Job
A few merge conflicts need to be addressed, but I think this PR is ready after that...
I merged these conflicts, @n2h9. I think that I did it correctly, but I see that the integration test is failing... 🤔
I merged these conflicts, @n2h9. I think that I did it correctly, but I see that the integration test is failing... 🤔
right, let me double check on this please . . .
I merged these conflicts, @n2h9. I think that I did it correctly, but I see that the integration test is failing... 🤔
right, let me double check on this please . . .
Hey @marblom007 hello :wave: :innocent: It was a missing import, updated, should be all right now :blush:
Thank you :bowing_woman:
--
Ha :smile: looks like it is still failing :cry: Let me triple check . . .
I merged these conflicts, @n2h9. I think that I did it correctly, but I see that the integration test is failing... 🤔
right, let me double check on this please . . .
Hey @marblom007 hello 👋 😇 It was a missing import, updated, should be all right now 😊
Thank you 🙇♀️
--
Ha 😄 looks like it is still failing 😢 Let me triple check . . .
Ok, this one is interesting:
=== RUN TestWithNatsIntegration
time="2025-04-18T18:32:45Z" level=error msg="Missing or outdated CRD. " app=meshsync code=1000 probable-cause="Missing or outdated CRD." severity=2 short-description="Error while initializing MeshSync configuration. .Config File \"meshsync_config\" Not Found in \"[/home/runner/.meshery]\"" suggested-remediation="Confirm that meshsyncs custom resource is present in the cluster."
.Config File "meshsync_config" Not Found in "[/home/runner/.meshery]\
this is related to this comment in internal/config/config.go:16
I inherited this change from this pr: https://github.com/meshery/meshsync/pull/361
Let me double check with Lee if we need this and come back you @marblom007 :hugs:
.Config File "meshsync_config" Not Found in "[/home/runner/.meshery]\
this is related to this comment in internal/config/config.go:16
I inherited this change from this pr: #361
Let me double check with Lee if we need this and come back you @marblom007 🤗
I will probably need to add a code here, which creates the folder $HOME/.meshery. I mean not before test, but in the meshsync itself.
And also there are fresh lint errors :slightly_smiling_face:
Let me fix this two issues and come back to you with updates :innocent:
I will probably need to add a code here, which creates the folder $HOME/.meshery. I mean not before test, but in the meshsync itself. And also there are fresh lint errors 🙂 Let me fix this two issues and come back to you with updates 😇
Hey hello :wave: :innocent: !
I have updated as mentioned above to:
- create $HOME/.meshery folder if it not exists;
- and fixed lint errors;
and also added test cases to ensure current nats integration is not broken :smile:
I would like also:
- to fix a cyclomatic complexity in main, as it is now huge after my changes (it was big but now huge :smile: )
- to double check the actual functionality of output to local file, as I was mostly concentrated last couple days on how to check that existing set up is not broken;
so will keep it as draft for now for a little longer, will mark as ready soon :innocent:
thank you :bowing_woman:
to fix a cyclomatic complexity in main, as it is now huge after my changes (it was big but now huge 😄 )
I started to do it, and updated couple paths which was added by me, but probably better not to do it in this pr. As it will require almost complete refactoring of main file. Just to avoid possible regression, not related to functionality. Let's fix cyclomatic complexity in a separate pr when this one will be merged :innocent:
-- By the way the average complexity for the main package dropped below 7, so this one is done :white_check_mark:
Added couple test cases which do checks when output mode is file;
Some good progress here. 🥇
Codecov Report
Attention: Patch coverage is 2.17391% with 360 lines in your changes missing coverage. Please review.
Project coverage is 4.46%. Comparing base (
1b87068) to head (50449ad). Report is 87 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #386 +/- ##
=========================================
- Coverage 5.50% 4.46% -1.05%
=========================================
Files 24 31 +7
Lines 1108 1411 +303
=========================================
+ Hits 61 63 +2
- Misses 1040 1341 +301
Partials 7 7
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 4.46% <2.17%> (-1.05%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Docs forthcoming separately.