Skip to content

Commit

Permalink
[test] fix exit code function, add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lgrd committed Mar 14, 2023
1 parent e231895 commit a45d7a5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Feature: Road2 service configuration
Given a valid configuration
And with parameter "test" for attribute "application.resources.directories.[1]" in service configuration
When I test the configuration
Then the configuration analysis should give an exit code 0
Then the configuration analysis should give an exit code 1
Then the server log should contain "Mauvaise configuration: Le dossier n'existe pas:"

Scenario: [service.json] (resources.directories sur deux dossiers qui n'existent pas et en chemins relatifs)
Expand Down Expand Up @@ -442,7 +442,7 @@ Feature: Road2 service configuration
Given a valid configuration
And with parameter "test" for attribute "application.sources.directories.[1]" in service configuration
When I test the configuration
Then the configuration analysis should give an exit code 0
Then the configuration analysis should give an exit code 1
Then the server log should contain "Mauvaise configuration: Le dossier n'existe pas:"

Scenario: [service.json] (sources.directories sur deux dossiers qui n'existent pas et en chemins relatifs)
Expand Down Expand Up @@ -480,8 +480,18 @@ Feature: Road2 service configuration
And an empty directory "empty_sources"
And with parameter "empty_sources" for attribute "application.sources.directories.[0]" in service configuration
When I test the configuration
Then the configuration analysis should give an exit code 0
Then the configuration analysis should give an exit code 1
Then the server log should contain "Le dossier des sources est vide"
Then the server log should contain "La ressource contient une source non disponible"

Given a valid configuration
And an empty directory "empty_resource"
And with parameter "empty_resource" for attribute "application.resources.directories.[0]" in service configuration
And an empty directory "empty_sources"
And with parameter "empty_sources" for attribute "application.sources.directories.[0]" in service configuration
When I test the configuration
Then the configuration analysis should give an exit code 0
Then the server log should contain "Le dossier des resources est vide"

# TODO
# Tester un dossier de ressources dont une des ressources ne peut être lues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ When("I test the configuration", function(done) {
});

Then("the configuration analysis should give an exit code {int}", function(code) {
assert.equal(this.verifyCommandExitCode(code), true);
assert.equal(this.returnCommandExitCode(), code);
});

Then("the server log should contain {string}", function(message) {
Expand Down
10 changes: 3 additions & 7 deletions test/functional/configuration/cucumber/features/support/world.js
Original file line number Diff line number Diff line change
Expand Up @@ -641,15 +641,11 @@ class road2World {

}

// Analyse du code de retour de la commande
verifyCommandExitCode(code) {
// Retourne le code de la commande
returnCommandExitCode() {

if (code === this._code) {
return true;
} else {
return this._code;
}


}

// Analyse des logs
Expand Down

0 comments on commit a45d7a5

Please sign in to comment.