Comments (4)
testScript can itself be a service that depends on the service that it testing. The testScript service should only start in CI.
Good idea! Once this PR is merged it will be super easy to run tests within process compose: once test process completes, other processes will be stopped and PC will exit with the code returned by the test process.
from services-flake.
Another approach
testScript
can itself be a service that depends on the service that it testing. The testScript
service should only start in CI.
from services-flake.
Note: this is mostly upstream work Platonic-Systems/process-compose-flake#36
from services-flake.
I have been thinking of different ways to implement this.
I have an idea and that involves having a testScript
option for every service (resolves #33).
{
testScript = lib.mkOption {
type = types.nullOr (types.functionTo types.package);
default = null;
description = ''
A package that contains a script to test the database.
The script will be run after the database has been initialized.
'';
example = lib.literalExpression
''
package: pkgs.writeShellApplication {
name = "test-postgres";
text = "echo 'SELECT version();' | ${package} -h 127.0.0.1";
};
'';
};
}
The option will be used to create a process that will execute the testScript
and end with whatever exit code the script returns (courtesy exit_on_end
).
{
"${name}-test" = lib.mkIf (config.testScript != null) {
command = config.testScript config.package;
depends_on."${name}".condition = "process_healthy";
availability.exit_on_end = true;
};
}
All looks good until we have more than one process that has a testScript
, in that case whichever script executes first will be ran and all the other processes are immediately shutdown because exit_on_end
waits for no one. I was thinking of a possible way to go around this by having a parent process that will use exit_on_end
and this process will depend on all the testScripts
. The parent process will have to somehow return the exit code 0 if all the testScripts
ran successfully or the non-zero exit code of the first process that fails. I can't think of any way this can be done, any suggestions?
from services-flake.
Related Issues (20)
- doc: Some todo checkboxes don't render HOT 1
- Link to the blog post
- docs: Add motivation / use case in README
- CI: binary cache requests by github-runners are blocked HOT 3
- Why are we overriding grafana?
- Conventional Commits pre-commit check is not working HOT 8
- Write docs for all services HOT 1
- Make `just changelog` dump changelog since last release (0.1.0) HOT 1
- docs: run haskell application as a process
- postgres: Document socket length limitation and workaround HOT 11
- example: pgweb: multiple databases HOT 2
- postgres: add an option exposing connection URI
- Testing docs HOT 1
- Compare services-flake with `numtide/devshell` HOT 4
- Option docs HOT 1
- Darwin: inconsistencies between CI and Runtime HOT 3
- ci: Update example sub-flakes on regular basis
- Could not create unix socket lock file error in mysql service when timezones are imported
- Feature: allow setting the UDS directory on MySql service
- Nginx config file location doesn't support relative imports HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from services-flake.