Commit Graph

25 Commits

Author SHA1 Message Date
Pagan Gazzard
d356f979d3 Always lower case the cpu id to avoid bouncing between casing when reporting
Change-type: patch
2023-02-15 13:54:40 +00:00
Felipe Lalanne
89175432af Find and remove duplicate networks
We have seen a few times devices with duplicated network names for some
reason. While we don't know the cause the networks get duplicates, this
can be disruptive for updates as trying to create a container referencing a duplicate
network results in a 400 error from the engine.

This commit finds and removes duplicate networks via the state engine,
this means that even if somehow a container could be referencing a
network that has been duplicated later somehow, this will remove the
container first.

While thies doesn't solve the problem of duplicate networks being
created in the first place, it will fix the state of the system to
correct the inconsistency.

Change-type: minor
Closes: #590
2023-02-10 20:24:36 -05:00
Christina Ying Wang
c4f9d72172 Remove dependent devices content in codebase
This includes:
- proxyvisor.js
- references in docs
- references device-state, api-binder, compose modules, API
- references in tests

The commit also adds a migration to remove the 4 dependent device tables from the DB.

Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-02-06 19:34:02 -08:00
Ruben Keulemans
9a1cde7f44 Support since and until in supervisor journalctl wrapper API.
Signed-off-by: Ruben Keulemans ruben.keulemans@protonmail.com
Change-type: minor
Closes: #2083
2023-02-01 09:17:10 +01:00
Felipe Lalanne
67d1503b54 Allow using colon character in config vars
The Raspberry Pi config.txt file defines the use of colon to configure
variables of the same name in different ports, for instance on those
devices with two hdmi ports. This syntax was previously not supported by
the supervisor. This change relaxes the syntax validation on config vars
to allow the use of the colon character.

Relates-to: #1573, #2046
Change-type: minor
2023-01-20 15:48:32 -03:00
Christina Ying Wang
e1bacda580 Update host-config, route, and action tests for host config endpoints
Change-type: minor
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-11 15:48:13 -08:00
Christina Ying Wang
c7db3189ad Use identify action for POST /v1/blink
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-09 16:01:43 -08:00
Christina Ying Wang
e351ed9803 Use runHealthchecks action for GET /v1/healthy
Signed-off-by: Christina Ying Wang <christina@balena.io>
2023-01-09 16:01:43 -08:00
Felipe Lalanne
91b119cbae Stop using host journalctl
The supervisor had to chroot into the host root in order to read the
journal logs. This won't be possible anymore once the supervisor becomes
an app. This commit copies the journalctl binary and necessary libraries
from a debian image into the supervisor image in order to be able to use
the tool on runtime.

Change-type: patch
2022-12-05 17:09:20 -03:00
Christina Ying Wang
f558be0a16 Create default network as config-only when services have host networking
This eliminates chances of host-Docker address collision for apps such
as the Supervisor where all services have host networking.

Closes: #2062
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-16 10:19:36 -08:00
pipex
827f892c13 Migrate all device config tests to integration.
This means that configuration backend tests no longer use stubs and
(mostly) avoid internal dependencies in the tests. Instead of stubs and
mock-fs, the tests use [testfs](https://github.com/balena-io-modules/mocha-pod#working-with-the-filesystem)
which allows working with a real filesystem and ensuring everything is
re-set between tests.

This is the last change needed in order to be able to merge #1971. Here is the list of changes

- [x] Migrate splash image backend tests
- [x] Migrate extlinux backend tests
- [x] Migrate config.txt backend tests
- [x] Migrate extra-uenv config tests
- [x] Migrate odmdata config tests
- [x] Migrate config utils tests
- [x] Migrate device-config tests

Change-type: patch
2022-11-14 11:12:52 -03:00
Christina Ying Wang
532e75a77e Migrate API tests to unit/integration
This excludes route tests or refactoring. Also, created tests
for API middleware.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-25 19:06:39 +00:00
pipex
aa3002f909 Migrate docker-util tests
Merged docker-utils and delta tests into a single test suite. They are
now ran as part of the integration tests using the real engine.

Change-type: patch
2022-10-19 12:05:52 -03:00
pipex
620bcae53a Migrate simple legacy tests to test/unit and test/integration
Change-type: patch
2022-10-18 20:36:53 -03:00
Ken Bannister
91f93952db Allow most printable ASCII chars for service label key
Change-type: patch
Signed-off-by: Ken Bannister <kb2ma@runbox.com>
2022-10-14 20:50:25 -04:00
Felipe Lalanne
f19f70d690 Migrate update-lock tests as integration tests
Update-lock tests now use the actual filesystem for testing, instead of
relying on stubs and spies.

This commit also fixes a small bug with update-lock that would cause a
`PromiseRejectionHandledWarning` when the lock callback would throw.
2022-09-28 10:37:41 -03:00
Felipe Lalanne
b81294431e Migrate compose/app and compose/app-manager tests
compose/app is run as part of the unit test suite
compose/application-manager is run as part of the integration test suite
2022-09-28 10:37:41 -03:00
Felipe Lalanne
a4da25c1ef Disable logs globally using mocha hooks 2022-09-28 10:37:41 -03:00
Felipe Lalanne
a5a24e6462 Split compose/service tests into unit/integration 2022-09-28 10:37:41 -03:00
Felipe Lalanne
cdc9868d29 Split compose/network test in unit/integration
Integration tests are ran in the engine instead of mockerode.
2022-09-28 10:37:40 -03:00
Felipe Lalanne
4113dde45d Split compose/volume tests into unit/integration
This also needs to modify the test environment as database migrations
will look for `config.json` in the location given by the variable
`CONFIG_MOUNT_POINT`.

The volume tests now run against the actual docker engine setup via dind

Change-type: patch
2022-09-28 10:37:40 -03:00
Felipe Lalanne
7833fa1ff3 Un-skip fs-utils test 2022-09-28 10:37:40 -03:00
Pagan Gazzard
96418d55b5 Update @balena/lint to 6.2.0
Change-type: patch
2022-09-19 16:41:28 +01:00
Felipe Lalanne
3e45e9561e Fix withDefault type helper to work with boolean
`withDefault` is a type helper that allows to create a type that
defaults to a default value when trying to decode a nullish value.
That type was not correctly working with boolean types, causing `false`
values to be replaced by true. This would specifically cause issues when
parsing the target state, where a `running: false` in a service would
become a `running: true` due to the type decoding.

Change-type: patch
2022-09-13 20:08:32 +00:00
Felipe Lalanne
c1e6dadeb4 Create test/unit and test/integration folders
This sets up the new `test/unit` and `test/integration` folders
and starts classification of some of the test files.

Note that unit tests include, `fs-utils` and `system-info` tests.

While these tests interact with the filesystem, the implementation
of these modules is simple enough, and the tests are fast enough to
allow these tests to fall under the `unit` test category (according to
test/README)

Change-type: patch
2022-08-24 14:28:36 -04:00