-
Notifications
You must be signed in to change notification settings - Fork 1
chore: test setup #25
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
Conversation
f7bd875 to
e171637
Compare
e82f3fc to
b2702bc
Compare
e171637 to
ddad687
Compare
fe902f2 to
69a7c0b
Compare
| @@ -0,0 +1,62 @@ | |||
| import { describe, it, before, after } from 'node:test'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@droguljic to simplify maintenance, we could move examples to tests, since we'd like to test each component, and integration between components anyway.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, examples serve the different purpose and having them is definitely valuable. I agree that we should test each component and integration between them.
In current state I'm not sure that examples could be just copied and run as is, if I remember correctly there was some issue when I tried to do so.
My suggestion would be to reference examples in tests and in that way we ensure that they are reproducible and on the other hand we test component and integration, while leaving them to serve their purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, but it might also become complex to maintain. If we're looking to match examples with tests, we'll either introduce noise to examples by having redundant examples, or to tests by trying to make use of a single example to test many properties and assumptions.
We could also have examples only serve as examples, and rely on test setup to provide deployable stacks. It definitely doesn't make sense to have deployable stacks in both tests and examples, as that's a lot of surface to maintain (upgrades, testing that it works, updating API...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Continuing on the offline conversation, the current idea is to keep complex uses cases that test integration between many components as part of examples, and more simpler ones as part of tests.
|
@droguljic can you review the high-level approach to testing and test setup? |
d05a23d to
3ef2ff2
Compare
bf538a6 to
cac1f87
Compare
package.json
Outdated
| "format": "prettier -w .", | ||
| "release": "npm run build && release-it", | ||
| "test": "" | ||
| "test": "node --test -r ts-node/register ./tests/**/*.test.ts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any advantages of using node test vs jest? Maybe we'd want to set default test runners across the company and show by example. This is a question, I don't know which is better or better-suited.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are differences. One big preference that I have is using test runners that use native execution environments such as node's native test runner, ava, or tape.
Generally speaking, jest pulls a lot of unnecessary dependencies and is slower. Depending on the use case, extra features can be helpful or not.
Where do you find value in standardizing a test runner for unit and integration tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent was to standardize the test runners across projects. But if native runners will perform better, then we should stick with those.
My idea was to use test runners which we would be able to recommend to people as a part of the CoP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I got that part, but I'm not actively developing for some time so I was genuinely curious to hear your thoughts. Might be worth exploring.
Let's bring it up during some future CoP thread or sync.
44b352e to
97b44ca
Compare
|
@mbareta @droguljic I addressed your comments. |
6e46198 to
670739d
Compare
Test setup
This PR adds a test setup that deploys infrastructure stacks using Pulumi Automation API and then runs tests using the NodeJS native test runner.
Changes
tests/**/*.test.*):npm test.WebServercomponent that deploys it with minimal configuration. Test asserts thathealthcheckendpoint returns200Disclaimers
Projectcomponent, deployment will throw an exception due to trying to take more than the maximum number of elastic IP addresses (eips).