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

chore: logging an example when generate-config fails #1308

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

PranshuSrivastava
Copy link
Member

@PranshuSrivastava PranshuSrivastava commented Jan 8, 2024

Related Issue

Improving the logging of Keploy when it fails due to the keploy config file.

Fixes: #1259

Describe the changes you've made

Added a log in record and test mode where we log an example to use the keploy-config file, whenever keploy fails because of it.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Screenshots (if any)

image

Signed-off-by: Pranshu Srivastava <iampranshu24@gmail.com>
Copy link

sweep-ai bot commented Jan 8, 2024

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.

@charankamarapu
Copy link
Member

will review by EOD

@charankamarapu
Copy link
Member

I think few other changes have got added in the PR. Please check once mainly in go.mod and go.sum file.

Copy link
Member

@charankamarapu charankamarapu left a comment

Choose a reason for hiding this comment

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

Please address the comments and check for changes in go.mod and go.sum file as those changes are from other commits. Rest looks good to me.

results, err := yaml.Marshal(node.Content[0])
if err != nil {
g.logger.Fatal("Failed to marshal the config", zap.Error(err))
}

err = os.WriteFile(filePath, results, os.ModePerm)
finalOutput := append(results, []byte(utils.ConfigGuide)...)
Copy link
Member

Choose a reason for hiding this comment

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

Is this tested that we are getting same config file as before..?

Copy link
Member Author

Choose a reason for hiding this comment

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

image yes, attaching screenshot for reference

Signed-off-by: Pranshu Srivastava <iampranshu24@gmail.com>
Signed-off-by: Pranshu Srivastava <iampranshu24@gmail.com>
Signed-off-by: Pranshu Srivastava <iampranshu24@gmail.com>
Copy link
Member

@charankamarapu charankamarapu left a comment

Choose a reason for hiding this comment

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

ship it!

@PranshuSrivastava PranshuSrivastava merged commit 0e7fde2 into keploy:main Jan 18, 2024
13 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

*errors.errorString: failed to get the record config from config file due to error: yaml: unmarshal errors:
2 participants