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

Adding Wing tests for the sdk #2114

Closed
6 of 7 tasks
tsuf239 opened this issue Apr 17, 2023 · 4 comments · Fixed by #2314 or #3357
Closed
6 of 7 tasks

Adding Wing tests for the sdk #2114

tsuf239 opened this issue Apr 17, 2023 · 4 comments · Fixed by #2314 or #3357
Assignees

Comments

@tsuf239
Copy link
Collaborator

tsuf239 commented Apr 17, 2023

Feature Spec

Use Cases

Testing wing SDK using wing code

Implementation Notes

Related issue:
Wing examples: organize all test files based on the language spec structure

SDK Tests coverage

Component

SDK

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@tsuf239 tsuf239 self-assigned this Apr 17, 2023
@ekeren
Copy link
Collaborator

ekeren commented Apr 24, 2023

@tsuf239

We should also have a public table that shows resources.api over the different types. Once you start finalising this issue, lets discuss

See #2240

@mergify mergify bot closed this as completed in #2314 May 2, 2023
mergify bot pushed a commit that referenced this issue May 2, 2023
partly fixes: #2114 
## Description

### <samp>🤖 Generated by Copilot at 781e3c1</samp>

This pull request enhances the test generation and execution capabilities of the `tools/hangar` module. It refactors the `generated_test_targets.ts` and `paths.ts` files to support different source directories and SDK tests. It also adds new snapshot files for the `test_corpus` directory that contain the expected outputs of the `wing compile` and `wing test` commands for various test files. 

## Walkthrough 

### <samp>🤖 Generated by Copilot at 781e3c1</samp>

*  Add new snapshot files for the expected outputs of the `wing compile -t tf-aws` and `wing test -t sim` commands for the test files in the `valid` and `sdk_tests` directories ([link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-853ac65d63b364a828d58dbef40299cf2b703f9edab5aff6db1fe6b9ce86d1e5R1-R199), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-f88d3d9f337d2054ddc2ada5d970c7baa4cf7664aafdae9d7d4cd47d95765e0eR1-R9), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-44d9595e87577a0504f2383c8eb94c4ee2fa74c97dd92de21c2bbc6f53b14708R1-R204), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-88dd32d7ad8eafb98ff997ba4f30eb26e78ea12565b60304a0c08cc52c230176R1-R9), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-09fab4b32f0772fc09bd00e38c747e8c0471503e938ba1e5a7a421e8a9d8cb5fR1-R399), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-6c5deaac42624eb88e9c9e5066831ca984590ae78b477acf139c110e7ff45455R1-R11), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-c06e4054a33568fa04ee0a42a35b5a2bec8c839b7511d05282f2fc2481688d96R1-R196), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-e84b66ac6a655c87e750acee2442d8c01689fe4bd1e2261a7496ff80fa25f297R1-R9), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-7050a19f02d0dd54a05b82e7f731215226e5998c4bbfc600081d22cb492df931R1-R203), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-40d7471c24b8591e97ad42d5af452f45fd41f5fcf48253bdc4c3762c6e128ebcR1-R9))
*  Modify `tools/hangar/src/generate_tests.ts` to generate test files for both the `valid` and the `sdk_tests` directories and pass the source directory as a parameter to the `compileTest` and `testTest` functions ([link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-434ef5311fa9b86e930861e996891b81f899b1de0cbbd00a7687d1b5b0b9b196L1-R73))
*  Modify `tools/hangar/src/generated_test_targets.ts` to accept the source directory as a parameter for the `compileTest` and `testTest` functions and use it in the `runWingCommand` calls and the `targetDir` variable ([link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-40029dc3fadbb75957c8497fdd6a55d98d34d9a02aa5ed8d953284af7711d588L2-R2), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-40029dc3fadbb75957c8497fdd6a55d98d34d9a02aa5ed8d953284af7711d588L10-R15), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-40029dc3fadbb75957c8497fdd6a55d98d34d9a02aa5ed8d953284af7711d588L22-R23), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-40029dc3fadbb75957c8497fdd6a55d98d34d9a02aa5ed8d953284af7711d588L55-R55), [link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-40029dc3fadbb75957c8497fdd6a55d98d34d9a02aa5ed8d953284af7711d588L63-R63))
*  Add a new constant `sdkTests` to `tools/hangar/src/paths.ts` that points to the `sdk_tests` directory ([link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-cc48fce987a579b4d6f7485a487b25e640136ebf9adf000de500a5f83f0fd157R8))
*  Remove an extra space in the `walkdir` function in `tools/hangar/src/paths.ts` ([link](https://github.com/winglang/wing/pull/2314/files?diff=unified&w=0#diff-cc48fce987a579b4d6f7485a487b25e640136ebf9adf000de500a5f83f0fd157L42-R47))

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
@staycoolcall911
Copy link
Contributor

Reopening, since #2314 only partially fixes this issue

@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.15.2.

@mergify mergify bot closed this as completed in #3357 Jul 12, 2023
mergify bot pushed a commit that referenced this issue Jul 12, 2023
## Description
Finally closes #2114 !!
1. handled tests: 
* hidden: api/ delete, patch, option, get, put, post - #3342
* hidden: bucket/events - #2724
* hidden: queue/timeout - #3354 
* fixed: counter/dec - there was a bug working with both key and initial key different than 0
* fixed: function/memory_and_env- adjusted test
* fixed: function/timeout- adjusted test
* fixed- table/add_row - the key wasn't saved in the object when adding a key on preflight on sim, fixed and adjusted test
* fixed - website/website - adjusted test
* fixed - util/env- adjusted test, since utils.env is working, it is just that the meta comments aren't followed when using the cli and not hangar

2. Run build to generate new snapshots
3. edited the compatibility matrix - leftover tests detected: #3358
 
## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://www.winglang.io/terms-and-policies/contribution-license.html)*.
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.24.12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
4 participants