aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test-unit/test-unit.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-12-18 10:58:25 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-12-18 11:04:53 +0100
commitf8b04951b4ccafdf28b875825edd46316fafb519 (patch)
treee86e965cd77f375fa1aee9858b56f34e7682a441 /src/tests/test-unit/test-unit.c
parenta8ffd5216cf61aa3dbf97d442e0e3184763d773f (diff)
afm-unit: Fix http port multi allocation
When serveral targets were set in the widget file, the framework allocated the same HTTP port to each. This lead to impossibility to run all targets or to a systemd conflict. This should fix the issue by allocating an HTTP port for each target installed by the widget. To achieves that goal, the afm-unit.conf tag for the port is moved from '#metadata.http-port' to '#metatarget.http-port'. Bug-AGL: SPEC-2068 Change-Id: I5376d6f052e0ffc5c77cc80041528637777aed1e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/tests/test-unit/test-unit.c')
-rw-r--r--src/tests/test-unit/test-unit.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tests/test-unit/test-unit.c b/src/tests/test-unit/test-unit.c
index 2b166e9..347135a 100644
--- a/src/tests/test-unit/test-unit.c
+++ b/src/tests/test-unit/test-unit.c
@@ -65,6 +65,12 @@ puts(json_object_to_json_string_ext(desc->desc, JSON_C_TO_STRING_PRETTY));
return 0;
}
+static int port()
+{
+ static int r = 10000;
+ return r++;
+}
+
int main(int ac, char **av)
{
struct unitconf conf;
@@ -73,7 +79,7 @@ int main(int ac, char **av)
conf.installdir = "INSTALL-DIR";
conf.icondir = "ICONS-DIR";
- conf.port = 666;
+ conf.port = port;
rc = unit_generator_open_template(*++av);
if (rc < 0)
error("can't read template %s: %m",*av);