Skip to content

nuxeo/rest-api-compatibility-tests

Repository files navigation

Nuxeo Platform REST API Compatibility Tests

Jenkins code style: prettier

Purpose

This project allows to validate the REST API versions that are supported in the Nuxeo Platform.

For each REST API version, we need to guarantee the following assertion:

For a given input, i.e. HTTP method, URI, query parameters, headers and request body, the client will always receive the same output, i.e. status code, response headers and response body.

This ensures compatibility between the Nuxeo Platform and the clients using any supported version of the REST API.

Example

Let's say that:

  • Server version 1.0 is released with REST API version 1.
  • Server version 2.0 is released with REST API version 2.

Calling the REST API version 1 must work exactly the same as on server 1.0 and server 2.0.

Clients must be able to call the REST API version 1 or 2 on server 2.0.

Requirements

Tests

The goal is to provide a complete test coverage of HTTP requests for each supported REST API version. This includes:

  • Endpoints.
  • Fetch properties.
  • Enrichers.
  • Web adapters.

To install the project's dependencies:

npm install

To run the tests, make sure that a Nuxeo server is up and available at http://localhost:8080/nuxeo, or the value of the NUXEO_SERVER_URL environment variable, then run:

npm test

To run a specific test:

npx vitest run test/v1/user/user-post.js

To run a set of tests matching a given pattern:

npx vitest run user-post

To debug the tests in VS Code, just start the Debug Vitest Tests debug configuration.

Structure

test/v1/group/group-delete.js
test/v1/group/group-get.js
test/v1/group/...
test/v1/user/user-delete.js
test/v1/user/user-enrichers.js
test/v1/user/...
test/v1/...

Lint/Format

To check linting with ESLint and code style with Prettier:

npm run lint

To format with Prettier:

npm run format

CI/CD

This set of tests is executed in a multibranch pipeline against a Nuxeo server configured as following:

  • Docker image: docker-private.packages.nuxeo.com/nuxeo/nuxeo:2023.x
  • MongoDB
  • Elasticsearch
  • Kafka

The build fails if at least one test fails.

This job is also triggered by the nuxeo/lts/nuxeo multibranch pipeline:

  • On pull requests, to run the REST API tests against the Nuxeo image freshly built from the related branch, and set a GitHub status check on the pull request.
  • On the main branch, to run the REST API tests against the latest Nuxeo image.

This adds a quality gate for the continuous delivery of the Nuxeo server.

About

Nuxeo Platform REST API Compatibility Tests

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors