-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alire.Crate_Configuration: fix, improve, and test value conflicts
- TOML value comparison was incorrect (use Equals function now) - The "set by" info was incorrect - Error message now show the conflicting values
- Loading branch information
1 parent
72f1355
commit 2cef73b
Showing
17 changed files
with
180 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...te/tests/crate_config/value_conflict/my_index/index/he/hello_world/hello_world-0.1.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
description = "\"Hello, world!\" demonstration project" | ||
name = "hello_world" | ||
version = "0.1.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
executables=['main'] | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[[depends-on]] | ||
libcrate_config_b = "*" | ||
libcrate_config_c = "*" |
1 change: 1 addition & 0 deletions
1
testsuite/tests/crate_config/value_conflict/my_index/index/index.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "1.1" |
12 changes: 12 additions & 0 deletions
12
...te_config/value_conflict/my_index/index/li/libcrate_config_a/libcrate_config_a-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description = "crate config demonstration project" | ||
name = "libcrate_config_a" | ||
version = "1.0.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[configuration.variables] | ||
Var_Bool = {type="Boolean"} |
15 changes: 15 additions & 0 deletions
15
...te_config/value_conflict/my_index/index/li/libcrate_config_b/libcrate_config_b-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
description = "crate config demonstration project" | ||
name = "libcrate_config_b" | ||
version = "1.0.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[[depends-on]] | ||
libcrate_config_a = "*" | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[configuration.values] | ||
libcrate_config_a.Var_Bool = true |
15 changes: 15 additions & 0 deletions
15
...te_config/value_conflict/my_index/index/li/libcrate_config_c/libcrate_config_c-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
description = "crate config demonstration project" | ||
name = "libcrate_config_c" | ||
version = "1.0.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[[depends-on]] | ||
libcrate_config_a = "*" | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[configuration.values] | ||
libcrate_config_a.Var_Bool = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Test that two crates setting the same config var to the different values is not | ||
ok. | ||
""" | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
|
||
import os | ||
import platform | ||
|
||
p = run_alr('get', 'hello_world', complain_on_error=False) | ||
assert p.status != 0, "alr should have errored" | ||
|
||
print(p.out) | ||
assert_match(".*\n" | ||
"ERROR: Conflicting value for configuration variable" | ||
" 'libcrate_config_a.var_bool'" | ||
" from 'libcrate_config_b' \(true\)" | ||
" and 'libcrate_config_c' \(false\).*" | ||
, | ||
p.out) | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
driver: python-script | ||
indexes: | ||
my_index: | ||
in_fixtures: false |
14 changes: 14 additions & 0 deletions
14
...suite/tests/crate_config/value_match/my_index/index/he/hello_world/hello_world-0.1.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
description = "\"Hello, world!\" demonstration project" | ||
name = "hello_world" | ||
version = "0.1.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
executables=['main'] | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[[depends-on]] | ||
libcrate_config_b = "*" | ||
libcrate_config_c = "*" |
1 change: 1 addition & 0 deletions
1
testsuite/tests/crate_config/value_match/my_index/index/index.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "1.1" |
12 changes: 12 additions & 0 deletions
12
...crate_config/value_match/my_index/index/li/libcrate_config_a/libcrate_config_a-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description = "crate config demonstration project" | ||
name = "libcrate_config_a" | ||
version = "1.0.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[configuration.variables] | ||
Var_Bool = {type="Boolean", default=true} |
15 changes: 15 additions & 0 deletions
15
...crate_config/value_match/my_index/index/li/libcrate_config_b/libcrate_config_b-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
description = "crate config demonstration project" | ||
name = "libcrate_config_b" | ||
version = "1.0.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[[depends-on]] | ||
libcrate_config_a = "*" | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[configuration.values] | ||
libcrate_config_a.Var_Bool = false |
15 changes: 15 additions & 0 deletions
15
...crate_config/value_match/my_index/index/li/libcrate_config_c/libcrate_config_c-1.0.0.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
description = "crate config demonstration project" | ||
name = "libcrate_config_c" | ||
version = "1.0.0" | ||
licenses = "GPL-3.0-only" | ||
maintainers = ["example@example.com"] | ||
maintainers-logins = ["mylogin"] | ||
|
||
[[depends-on]] | ||
libcrate_config_a = "*" | ||
|
||
[origin] | ||
url = "file:." | ||
|
||
[configuration.values] | ||
libcrate_config_a.Var_Bool = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Test that two crates setting the same config var to the same value is ok. | ||
""" | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
|
||
import os | ||
import platform | ||
|
||
p = run_alr('get', 'hello_world') | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
driver: python-script | ||
indexes: | ||
my_index: | ||
in_fixtures: false |