-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Tests for PATCH
endpoints do not run test steps
#36
Comments
Welcome to the Microcks community! 💖 Thanks and congrats 🎉 for opening your first issue here! Be sure to follow the issue template or please update it accordingly. 📢 If you're using Microcks in your organization, please add your company name to this list. 🙏 It really helps the project to gain momentum and credibility. It's a small contribution back to the project with a big impact. If you need to know why and how to add yourself to the list, please read the blog post "Join the Microcks Adopters list and Empower the vibrant open source Community 🙌" Hope you have a great time there! |
I did a quick test and cannot reproduce it. I think I'd need further information to investigate on this... What I've done so far:
import * as path from "path";
import { TestContainers } from "testcontainers";
import { MicrocksContainer, TestRequest, TestRunnerType } from "./microcks-container";
describe("NordicAPI", () => {
jest.setTimeout(180_000);
const resourcesDir = path.resolve(__dirname, "..", "test-resources");
// start and contract test {
it("should start, load artifacts and contract tets mock", async () => {
await TestContainers.exposeHostPorts(8585);
const container = await new MicrocksContainer().start();
await container.importAsMainArtifact(path.resolve(resourcesDir, "nordic.json"));
var testRequest: TestRequest = {
serviceId: "Nordic API:2.0.0",
runnerType: TestRunnerType.OPEN_API_SCHEMA,
testEndpoint: "http://host.testcontainers.internal:8585/rest/Nordic+API/2.0.0",
timeout: 2000,
filteredOperations: [
"PATCH /jobs/{jobId}/executions"
]
}
var testResult = await container.testEndpoint(testRequest);
console.log('testResult: ' + JSON.stringify(testResult));
expect(testResult.success).toBe(true);
});
}); Got the final result where test is a success: $ node 'node_modules/.bin/jest' '/Users/laurent/Development/github/microcks-testcontainers-node/src/nordic.test.ts' -t 'NordicAPI should start, load artifacts and contract tets mock'
=== OUTPUT ===
console.log
testResult: {"id":"66b9c697d1d67157accb05bd","version":2,"testNumber":1,"testDate":1723451031074,"testedEndpoint":"http://host.testcontainers.internal:8585/rest/Nordic+API/2.0.0","serviceId":"66b9c696d1d67157accb05b6","timeout":2000,"elapsedTime":46,"success":true,"inProgress":false,"runnerType":"OPEN_API_SCHEMA","testCaseResults":[{"success":true,"elapsedTime":46,"operationName":"PATCH /jobs/{jobId}/executions","testStepResults":[{"success":true,"elapsedTime":46,"requestName":"66a2afc3-ab5b-4437-ae7c-0bf0d79c72ca","message":""}]}]}
at Object.<anonymous> (src/nordic.test.ts:33:13)
PASS src/nordic.test.ts (7.733 s)
NordicAPI
✓ should start, load artifacts and contract tets mock (6957 ms)
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 7.784 s Can you help to confirm I understood the logic, and by providing additional information like versions and distros of the different Microcks instances? |
Thank you very for taking valuable time to investigate this, and so thoroughly. I will look into this further at our end ASAP and get back with you. For now I think it's safe to say that we are doing something wrong. |
It appears to have been our error. Many thanks again for your prompt attention, and apologies for the time waste. |
Describe the bug
Tests for
PATCH
endpoints do not run test steps. (Or so it appears.)We have a set of tests that contain
GET
,POST
andPATCH
operations. All of these automated tests are green when we run them against a Microcks instance started via Docker Compose. If we instead run them against a Microcks instance running in testcontainers, thePATCH
operations fail with:I have also duplicated this by spinning up a Microcks server that is long running (i.e., not spun up by jest), and then used the Test API via curl, e.g., the following, the with same result (green against Docker Compose server, red against testcontainers server):
Expected behavior
All operations test the same, whether run against a Docker Compose-based server or testcontainers-based.
Actual behavior
See above.
How to Reproduce?
Not sure about the easiest way to test this, but here are two endpoints involved in the tests:
Aside from the two different HTTP methods, could the issue be related to the use of
application/merge-patch+json
forPATCH
operations?I see nothing in the Microcks testcontainer logs.
Microcks version or git rev
No response
Install method (
docker-compose
,helm chart
,operator
,docker-desktop extension
,...)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: