Intrinsic function short form usage in integration test fixtures causes fixture loading to fail
See original GitHub issueWhen writing an integration test for the framework, using any intrinsic function short syntax - i.e. !GetAtt
instead of Fn::GetAtt
- causes fixtures.setup
to return null without triggering an error. This is quite confusing as short syntax is perfectly fine for deploying the same service in the context of an actual project.
In the exemple of test/fixtures/httpApiExport/serverless.yml
, using Ref: HttpApi
works perfectly fine
However, replacing this with short syntax (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html#ref-declaration) !Ref HttpApi
will cause fixture setup to fail.
⚠️⚠️ REPLACE WITH FULL COMMAND NAME
output
AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx npx mocha test/integration/httpApi.test.js
Installed version
Framework Core: 2.15.0
Plugin: 4.2.0
SDK: 2.3.2
Components: 3.4.3
IMHO, the issue comes from @serverless/test
package get-fixtures-engine.js
file code block bellow :
try {
return loadYaml(configContent);
} catch (error) {
return null;
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Rails 4: Why do fixtures make this test fail? - Stack Overflow
I have the test below and if there are any fixtures for this model it fails with total_unapproved and new_total being equal instead...
Read more >Testing in Go: Fixtures - Ilija Eftimov
The setup using fixtures is done to satisfy any preconditions there may be for the code under test. For example, code that we...
Read more >Integration tests in ASP.NET Core | Microsoft Learn
Learn how integration tests ensure that an app's components function correctly at the infrastructure level, including the database, ...
Read more >FUNCTIONAL TEST SYSTEMS | Intrinsic Quality LLC
Intrinsic Quality delivers turnkey standalone Functional Test fixtures and Windows based functional testers that are custom engineered with innovation and ...
Read more >can't use fixtures with a created engine · Issue #4971 · rails/rails
i create an engine, and some models, then i started to test, on 'rake test' command i realized that the fixtures are not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure, it’s released now. Still there’s no need to bump version in
serverless
, as CI automatically is run against latest version of dependencies and we always bump dependencies prior releasing new version (so it’s guaranteed to happen then)@fredericbarthelet I see, the problem is at part in which fixture engine tries to assign a generated service name to the config. It parses the config and crashes.
While just for fixture setup purpose I would argue, that we can simply not use shorthand syntax. Still I think it’s valuable to have support for that, for the sake of testing that short syntax works as expected.
I believe it can be fixed by:
PR’s in all those projects are welcome!