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

chore: Updated versioned tests to support upcoming tooling #2147

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
99 changes: 99 additions & 0 deletions test/versioned/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Versioned Tests

The subdirectories within this directory represent test suites that verify
our agent compatibility across multiple versions of our supported modules.
When these tests are run, through our versioned test runner tool, each suite
is run multiple times utilizing different versions of the module that satisfy
configured version constraints.

For example, if a supported module has releases `1.0.0` through `1.10.0`, with
a version for each minor between `0` and `10`, then our versioned test runner
will run the test suite across a sampling of versions in that range, e.g.
versions `1.0.0`, `1.3.0`, and `1.10.0`.

## Versioned Tests `package.json`

The versioned test runner reads a `package.json` in each test suite. This
`package.json` describes the constraints for the suite and has a few properties
that are specific to our versioned test runner. The following is a
[jsonc](https://en.wikipedia.org/wiki/JSON#JSONC) representation of such a
`package.json` that describes the unique properties:

```jsonc
{
// `name` is typically ignored.
"name": "module-tests",

// `targets` indicates which modules are being verified by the test suite.
// This is utilized by tooling to build a compatibility document. There _must_
// be at least one value that matches a dependency name in a subsequent
// `tests` block. If this suite is verifying the compatibility of multiple
// modules, include all such module names in the array.
"targets": ["module"],

// `version` is ignored.
"version": "0.0.0",

// `private` should be set to `true`.
"private": true,

// `tests` contains blocks that describe the tests the versioned test runner
// should run for this suite and under what constraints. Each block will
// result in at least one test run by the test runner.
"tests": [
{
// `engines` is a typical package.json engines block.
"engines": {
// `node` indicates which versions of Node.js should be used to run
// this test block. Typically, a basic `>=` qualifier will be used, but
// a static version is also likely. If the version of Node.js being
// used to run the suite does not match the contraint, then the test
// block will be skipped.
"node": ">= 18"
},

// `dependencies` lists dependencies that a needed in order to execute
// the test block. In most cases, only the module under test will be
// present.
"dependencies": {
// For the dependency named "module-name", run the suite with samples
// from the provided semver range (https://docs.npmjs.com/cli/v6/using-npm/semver#advanced-range-syntax).
//
// The minimum version across all test blocks will be utilized to
// indicate the minimum supported version of a module by our agent
// if that module name is listed in the top-level `targets` property.
//
// Note: this may also be an object with a special format. See the next
// example block.
"module-name": ">=1.0.0 <2.0.0"
},

// `files` lists out the test files that comprise the test suite for the
// current block.
"files": [
"test-one.tap.js",
"test-two.tap.js"
]
},

// This example block will only run on Node.js 20.x. Pay attention
// to the "dependencies" section for a special depedency declaration
// supported by our versioned test runner.
{
"engines": { "node": "20" },
"dependencies": {
"module-name": {
// Again, a standard semver range to indicate the versions of the
// module to sample from.
"versions": ">=1.0.0 <2.0.0",

// How many samples, across the provided versions range, to conduct
// when testing with this test block. It should be a string value,
// although some of our tooling will likely coerce it to an integer.
"samples": "2"
}
}
}
]
}
```
1 change: 1 addition & 0 deletions test/versioned/amqplib/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "ampqlib-tests",
"targets": ["amqplib"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
5 changes: 3 additions & 2 deletions test/versioned/bluebird/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "bluebird-tests",
"targets": ["bluebird"],
"version": "0.0.0",
"private": true,
"tests": [
Expand All @@ -8,7 +9,7 @@
"node": ">=16"
},
"dependencies": {
"bluebird": ">=2"
"bluebird": ">=2.0.0"
},
"files": [
"regressions.tap.js",
Expand All @@ -20,7 +21,7 @@
"node": ">=16"
},
"dependencies": {
"bluebird": ">=3"
"bluebird": ">=3.0.0"
},
"files": [
"methods.tap.js"
Expand Down
1 change: 1 addition & 0 deletions test/versioned/bunyan/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "bunyan-tests",
"targets": ["bunyan"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/cassandra-driver/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "cassandra-driver-tests",
"targets": ["cassandra-driver"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/cls/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "cls-tests",
"targets": ["continuation-local-storage"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't instrument cls, i think this is just a test to make sure we don't affect it. you can prob omit this one

"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/connect/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "connect-tests",
"targets": ["connect"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
3 changes: 2 additions & 1 deletion test/versioned/director/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "director-tests",
"targets": ["director"],
"version": "0.0.0",
"private": true,
"tests": [
Expand All @@ -8,7 +9,7 @@
"node": ">=16"
},
"dependencies": {
"director": ">=1.2",
"director": ">=1.2.0",
"express": "4.16"
},
"files": [
Expand Down
3 changes: 3 additions & 0 deletions test/versioned/elastic/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
{
"name": "elasticsearch-tests",
"targets": ["@elastic/elasticsearch"],
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=16"
},
"tests": [
{
"supported": false,
"comment": "Used to assert our instrumentation does not get loaded on old versions.",
"engines": {
"node": ">=16"
},
Expand Down
1 change: 1 addition & 0 deletions test/versioned/express-esm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "express-esm-tests",
"targets": ["express"],
"version": "0.0.0",
"type": "module",
"private": true,
Expand Down
1 change: 1 addition & 0 deletions test/versioned/express/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "express-tests",
"targets": ["express"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "fastify-tests",
"targets": ["fastify"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/generic-pool/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "generic-pool-tests",
"targets": ["generic-pool"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/grpc-esm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "grpc-esm-tests",
"targets": ["@grpc/grpc-js"],
"version": "0.0.0",
"type": "module",
"private": true,
Expand Down
1 change: 1 addition & 0 deletions test/versioned/grpc/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "grpc-tests",
"targets": ["@grpc/grpc-js"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/hapi/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "hapi-tests",
"targets": ["@hapi/hapi"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
3 changes: 2 additions & 1 deletion test/versioned/ioredis/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "ioredis-test",
"targets": ["ioredis"],
"version": "0.0.0",
"private": true,
"tests": [
Expand All @@ -19,7 +20,7 @@
"node": ">=16"
},
"dependencies": {
"ioredis": ">=4"
"ioredis": ">=4.0.0"
},
"files": [
"ioredis.tap.js"
Expand Down
1 change: 1 addition & 0 deletions test/versioned/langchain/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "langchain-tests",
"targets": ["@langchain/core"],
"version": "0.0.0",
"private": true,
"engines": {
Expand Down
1 change: 1 addition & 0 deletions test/versioned/mongodb-esm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "mongodb-esm-tests",
"targets": ["mongodb"],
"version": "0.0.0",
"type": "module",
"private": true,
Expand Down
1 change: 1 addition & 0 deletions test/versioned/mongodb/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "mongodb-tests",
"targets": ["mongodb"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/mysql/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "mysql-tests",
"targets": ["mysql"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/mysql2/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "mysql2-tests",
"targets": ["mysql2"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/nestjs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "nestjs-tests",
"targets": ["@nestjs/cli"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/openai/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "openai-tests",
"targets": ["openai"],
"version": "0.0.0",
"private": true,
"engines": {
Expand Down
5 changes: 3 additions & 2 deletions test/versioned/pg-esm/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "pg-esm-tests",
"targets": ["pg"],
"type": "module",
"version": "0.0.0",
"private": true,
Expand All @@ -9,7 +10,7 @@
"node": ">=16.12.0"
},
"dependencies": {
"pg": ">=8.2 <8.8",
"pg": ">=8.2.0 <8.8.0",
"pg-native": ">=2"
},
"files": [
Expand All @@ -23,7 +24,7 @@
"node": ">=16.12.0"
},
"dependencies": {
"pg": ">=8.8",
"pg": ">=8.8.0",
"pg-native": ">=3"
},
"files": [
Expand Down
5 changes: 3 additions & 2 deletions test/versioned/pg/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "pg-tests",
"targets": ["pg"],
"version": "0.0.0",
"private": true,
"tests": [
Expand All @@ -8,7 +9,7 @@
"node": ">=16"
},
"dependencies": {
"pg": ">=8.2 <8.8",
"pg": ">=8.2.0 <8.8.0",
"pg-native": ">=2"
},
"files": [
Expand All @@ -22,7 +23,7 @@
"node": ">=16"
},
"dependencies": {
"pg": ">=8.8",
"pg": ">=8.8.0",
"pg-native": ">=3"
},
"files": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/pino/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "pino-tests",
"targets": ["pino"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down
1 change: 1 addition & 0 deletions test/versioned/prisma/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "prisma-tests",
"targets": ["@prisma/client"],
"version": "0.0.0",
"private": true,
"engines": {
Expand Down
5 changes: 3 additions & 2 deletions test/versioned/redis/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "redis-tests",
"targets": ["redis"],
"version": "0.0.0",
"private": true,
"tests": [
Expand Down Expand Up @@ -41,7 +42,7 @@
"node": ">=16"
},
"dependencies": {
"redis": ">=2.6.0 < 4"
"redis": ">=2.6.0 < 4.0.0"
},
"files": [
"redis.tap.js"
Expand All @@ -52,7 +53,7 @@
"node": ">=16"
},
"dependencies": {
"redis": ">=4"
"redis": ">=4.0.0"
},
"files": [
"redis-v4.tap.js"
Expand Down