mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-24 23:57:57 +01:00
draft for integration test setup
This commit is contained in:
parent
9c87c192fa
commit
06d82f9fc6
11
examples/docker/integration/README.md
Normal file
11
examples/docker/integration/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Integration tests with Docker
|
||||
|
||||
## How it works
|
||||
* spawns 2 instances of our bffh container and required mqqt broker
|
||||
* spawns an additional debian to run a shell
|
||||
* the containers can reach each other by their hostname
|
||||
|
||||
## How to start
|
||||
|
||||
* run `docker-compose up --exit-code-from test-manager` in this directory
|
||||
* this will kill all containers when
|
20
examples/docker/integration/config_a/bffh.dhall
Normal file
20
examples/docker/integration/config_a/bffh.dhall
Normal file
@ -0,0 +1,20 @@
|
||||
{ actor_connections = [{ _1 = "Testmachine", _2 = "Actor" }]
|
||||
, actors =
|
||||
{ Actor = { module = "Shelly", params = {=} }
|
||||
}
|
||||
, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }]
|
||||
, initiators =
|
||||
{ Initiator = { module = "Dummy", params = {=} }
|
||||
}
|
||||
, listens = [{ address = "::", port = Some 59661 }]
|
||||
, machines =
|
||||
{ Testmachine =
|
||||
{ description = Some "A test machine"
|
||||
, disclose = "lab.test.read"
|
||||
, manage = "lab.test.admin"
|
||||
, name = "Testmachine"
|
||||
, read = "lab.test.read"
|
||||
, write = "lab.test.write"
|
||||
} }
|
||||
, mqtt_url = "tcp://mqtt-a:1883"
|
||||
}
|
1
examples/docker/integration/config_a/pass.toml
Normal file
1
examples/docker/integration/config_a/pass.toml
Normal file
@ -0,0 +1 @@
|
||||
Testuser = "secret"
|
20
examples/docker/integration/config_a/roles.toml
Normal file
20
examples/docker/integration/config_a/roles.toml
Normal file
@ -0,0 +1,20 @@
|
||||
[testrole]
|
||||
name = "Testrole"
|
||||
permissions = [
|
||||
"lab.test.*"
|
||||
]
|
||||
|
||||
[somerole]
|
||||
name = "Somerole"
|
||||
parents = ["testparent%lmdb"]
|
||||
permissions = [
|
||||
"lab.some.admin"
|
||||
]
|
||||
|
||||
[testparent]
|
||||
name = "Testparent"
|
||||
permissions = [
|
||||
"lab.some.write",
|
||||
"lab.some.read",
|
||||
"lab.some.disclose",
|
||||
]
|
11
examples/docker/integration/config_a/users.toml
Normal file
11
examples/docker/integration/config_a/users.toml
Normal file
@ -0,0 +1,11 @@
|
||||
[Testuser]
|
||||
# Define them in roles.toml as well
|
||||
roles = []
|
||||
|
||||
# If two or more users want to use the same machine at once the higher prio
|
||||
# wins
|
||||
priority = 0
|
||||
|
||||
# You can add whatever random data you want.
|
||||
# It will get stored in the `kv` field in UserData.
|
||||
noot = "noot!"
|
20
examples/docker/integration/config_b/bffh.dhall
Normal file
20
examples/docker/integration/config_b/bffh.dhall
Normal file
@ -0,0 +1,20 @@
|
||||
{ actor_connections = [{ _1 = "Testmachine", _2 = "Actor" }]
|
||||
, actors =
|
||||
{ Actor = { module = "Shelly", params = {=} }
|
||||
}
|
||||
, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }]
|
||||
, initiators =
|
||||
{ Initiator = { module = "Dummy", params = {=} }
|
||||
}
|
||||
, listens = [{ address = "::", port = Some 59661 }]
|
||||
, machines =
|
||||
{ Testmachine =
|
||||
{ description = Some "A test machine"
|
||||
, disclose = "lab.test.read"
|
||||
, manage = "lab.test.admin"
|
||||
, name = "Testmachine"
|
||||
, read = "lab.test.read"
|
||||
, write = "lab.test.write"
|
||||
} }
|
||||
, mqtt_url = "tcp://mqtt-b:1883"
|
||||
}
|
1
examples/docker/integration/config_b/pass.toml
Normal file
1
examples/docker/integration/config_b/pass.toml
Normal file
@ -0,0 +1 @@
|
||||
Testuser = "secret"
|
20
examples/docker/integration/config_b/roles.toml
Normal file
20
examples/docker/integration/config_b/roles.toml
Normal file
@ -0,0 +1,20 @@
|
||||
[testrole]
|
||||
name = "Testrole"
|
||||
permissions = [
|
||||
"lab.test.*"
|
||||
]
|
||||
|
||||
[somerole]
|
||||
name = "Somerole"
|
||||
parents = ["testparent%lmdb"]
|
||||
permissions = [
|
||||
"lab.some.admin"
|
||||
]
|
||||
|
||||
[testparent]
|
||||
name = "Testparent"
|
||||
permissions = [
|
||||
"lab.some.write",
|
||||
"lab.some.read",
|
||||
"lab.some.disclose",
|
||||
]
|
11
examples/docker/integration/config_b/users.toml
Normal file
11
examples/docker/integration/config_b/users.toml
Normal file
@ -0,0 +1,11 @@
|
||||
[Testuser]
|
||||
# Define them in roles.toml as well
|
||||
roles = []
|
||||
|
||||
# If two or more users want to use the same machine at once the higher prio
|
||||
# wins
|
||||
priority = 0
|
||||
|
||||
# You can add whatever random data you want.
|
||||
# It will get stored in the `kv` field in UserData.
|
||||
noot = "noot!"
|
26
examples/docker/integration/docker-compose.yaml
Normal file
26
examples/docker/integration/docker-compose.yaml
Normal file
@ -0,0 +1,26 @@
|
||||
version: "3.8"
|
||||
services:
|
||||
bffh-a:
|
||||
image: registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest
|
||||
command: ["sh", "-c", "diflouroborane -c /etc/bffh/bffh.dhall --load=/etc/bffh; diflouroborane -c /etc/bffh/bffh.dhall"]
|
||||
volumes:
|
||||
# generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section.
|
||||
- "./config_a:/etc/bffh"
|
||||
links:
|
||||
- mqtt-a
|
||||
mqtt-a:
|
||||
image: eclipse-mosquitto
|
||||
bffh-b:
|
||||
image: registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest
|
||||
command: ["sh", "-c", "diflouroborane -c /etc/bffh/bffh.dhall --load=/etc/bffh; diflouroborane -c /etc/bffh/bffh.dhall"]
|
||||
volumes:
|
||||
# generate a sample config.toml by running "docker run registry.gitlab.com/fabinfra/fabaccess/bffh:dev-latest --print-default > examples/config.toml" from the project root. You may have to delete the ipv6 listen section.
|
||||
- "./config_b:/etc/bffh"
|
||||
links:
|
||||
- mqtt-b
|
||||
mqtt-b:
|
||||
image: eclipse-mosquitto
|
||||
|
||||
test-manager:
|
||||
image: debian
|
||||
tty: true
|
Loading…
Reference in New Issue
Block a user