labbati/randomized-paths

Random paths generator from DataDog/dd-trace-php/tests/randomized

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/labbati/randomized-paths

v8.1.3.0 2022-03-29 09:24 UTC

README

Composer package to make available to any project randomized paths generated by DataDog/dd-trace-php/tests/randomized/app generator.

This is absolutely not intended for production. This is only usable for testing environments.

Usage

Depending on the version, add the following to your composer.json.

{
    ...
    "require-dev": {
        "labbati/randomized-paths": "<PHP_MAJOR>.<PHP_MINOR>.*"
    }
    ...
}

You need some companion services to run this tool. You can cherry-pick them from the list below.

// docker-compose.yml

....

  redis:
    image: redis:latest

  httpbin:
    image: kennethreitz/httpbin

  memcached:
    image: "memcached:1.5-alpine"

  elasticsearch:
    image: "elasticsearch:6.8.13"
    environment:
      - discovery.type=single-node

  mysql:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=test
      - MYSQL_PASSWORD=test
      - MYSQL_USER=test
      - MYSQL_DATABASE=test

....

Use them (adjust host names)


use RandomizedTests\RandomExecutionPath;
use RandomizedTests\RandomExecutionPathConfiguration;
use RandomizedTests\SnippetsConfiguration;

$snippetsConfiguration = (new SnippetsConfiguration())
    ->withHttpBinHost('httpbin')
    ->withElasticSearchHost('elasticsearch')
    ->withMysqlHost('mysql')
    ->withMysqlUser('test')
    ->withMysqlPassword('test')
    ->withMysqlDb('test')
    ->withRedisHost('redis')
    ->withMemcachedHost('memcached');
$randomizerConfiguration = new RandomExecutionPathConfiguration(
    $snippetsConfiguration,
    isset($queries['seed']) ? intval($queries['seed']) : null,
    true, // true for web, false for CLI
    isset($queries['execution_path'])
);