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

test: add runtime testing for Go models #1484

Merged
merged 5 commits into from
Aug 28, 2023

Conversation

Devansh-Bhatt
Copy link
Contributor

@Devansh-Bhatt Devansh-Bhatt commented Aug 18, 2023

Description

  • Created a Go Project under test/runtime/runtime-go
  • Added a simple test-code generations script at: test/runtime/runtime-go
  • Added a generation script in package.json
  • Ran the generation script and ignored the directory test/runtime/runtime-go/target which contained the auto generated models as a result of running the generation script
  • Manually added a simple test for the generated models under test/runtime/runtime-go/Test_Go/Test_Address.go
  • Added a jet script to execute the Go test
  • Added the script to the run the test in package.json
  • Create CI Workflow that runs the runtime test under .github/workflows/runtime-go-testing.yml

Related issue(s)
Resolves #1333

@netlify
Copy link

netlify bot commented Aug 18, 2023

Deploy Preview for modelina ready!

Name Link
🔨 Latest commit 934d2fa
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/64eb45cbc32f750008401120
😎 Deploy Preview https://deploy-preview-1484--modelina.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

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

Looks great @Devansh-Bhatt!

Just got those two comments, and then please use test: as the PR title 🙂

Comment on lines 37 to 40
Members: nil,
ArrayType: nil,
NestedObject: nil,
AdditionalProperties: nil,
Copy link
Member

Choose a reason for hiding this comment

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

@Devansh-Bhatt if you look at one of the other runtime test, do you mind using the same values as in there? 🙂

"testing"
)

func TestShouldbeAbleToSerializeModel(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

We still need to compare the actual serialized value with something we expect, you can grab the one in the other runtime test 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jonaslagoni .. I tried to find the expected json in other runtime-tests but couldn't find one. The closest thing i found was under typescript-test where the serialized json was expected : {\"street_name\": \"test\",\"house_number\": 1,\"array_type\": [1,\"test\"],\"nestedObject\": {\"test\": \"test\"}} and this was done for every field of the Address Struct.
Do you expect me to do the same as done in typescript ?
[As in java and other languages i did not find any expected json's] 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Yep, thats about it 👍

@coveralls
Copy link

coveralls commented Aug 19, 2023

Pull Request Test Coverage Report for Build 5964862281

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.05%) to 92.194%

Files with Coverage Reduction New Missed Lines %
src/generators/php/constrainer/PropertyKeyConstrainer.ts 1 90.0%
Totals Coverage Status
Change from base Build 5986047940: -0.05%
Covered Lines: 5261
Relevant Lines: 5564

💛 - Coveralls

@Devansh-Bhatt Devansh-Bhatt changed the title Added runtime testing for Go models #1333 test: Added runtime testing for Go models #1333 Aug 24, 2023
@Devansh-Bhatt Devansh-Bhatt changed the title test: Added runtime testing for Go models #1333 test: added runtime testing for Go models #1333 Aug 24, 2023
@jonaslagoni jonaslagoni changed the title test: added runtime testing for Go models #1333 test: add runtime testing for Go models Aug 27, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 27, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
3.4% 3.4% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@Devansh-Bhatt
Copy link
Contributor Author

@jonaslagoni Is there any issue with the commit / changes that i made. I quite don't seem to understand what's the issue here 😕

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@jonaslagoni jonaslagoni merged commit 3ebc6b2 into asyncapi:master Aug 28, 2023
17 of 19 checks passed
@jonaslagoni
Copy link
Member

@all-contributors please add @Devansh-Bhatt for test, infra

@allcontributors
Copy link
Contributor

@jonaslagoni

I've put up a pull request to add @Devansh-Bhatt! 🎉

@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.9.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 2.0.0-next.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add runtime testing for Go
4 participants