Commit Graph

4157 Commits

Author SHA1 Message Date
Christina Ying Wang
75bf2aa3b4 Improve NotFoundError handling
Use isNotFoundError which converts an error of the default type
`unknown` into NotFoundError if the error is an instance of NotFoundError.
Thrown errors are of type `unknown` by default so we should use methods
with type guards for better type narrowing.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-08 15:41:52 -08:00
Balena CI
80e213ab7e
v14.2.21 2022-11-07 21:20:00 +00:00
bulldozer-balena[bot]
fbdd43d00a
Merge pull request #2053 from balena-os/fix-unmanaged-target-state-behavior
Allow local target state to be applied in unmanaged mode
2022-11-07 21:18:37 +00:00
Christina Ying Wang
fd320f85b5 Allow local target state to be applied in unmanaged mode
An unmanaged Supervisor will not have a balenaApi defined, so any
attempts to POST /v2/local/target-state will cause the Supervisor to
crash loop. This fix allows for the Supervisor to apply local target
state, which is useful for integration testing.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-07 12:25:41 -08:00
Christina Ying Wang
fc15ad2554 Fix typo: intialise -> initialize
Missing "i"

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-07 12:09:17 -08:00
Balena CI
f5ec74211f
v14.2.20 2022-11-03 22:27:41 +00:00
bulldozer-balena[bot]
d1825a18e2
Merge pull request #2050 from balena-os/vipul/update-locks
patch: Update locks behavior for config changes
2022-11-03 22:26:18 +00:00
Balena CI
c4b2cb867e
v14.2.19 2022-11-03 21:20:53 +00:00
bulldozer-balena[bot]
ff7f43c7f2
Merge pull request #2052 from balena-os/run-sv-in-container
Run the built supervisor as part of docker-compose tests
2022-11-03 21:17:21 +00:00
Felipe Lalanne
46fa7321c0 Run the built supervisor as part of docker-compose tests
This allows to test that the supervisor build actually runs and opens up the
possibility of running more exhaustive API tests against a working supervisor.

Change-type: patch
2022-11-03 15:45:39 -03:00
Felipe Lalanne
460c3ba0aa Remove DOCKER_ROOT assignments from entry.sh
These variables are not used anywhere and they don't seem to serve any
purpose. Cleaning these assingments as dead code
2022-11-03 10:33:51 -03:00
Balena CI
0bb3f0ad1f
v14.2.18 2022-11-02 19:00:54 +00:00
bulldozer-balena[bot]
9549491922
Merge pull request #2051 from balena-os/update-before-dbus-install
Update apt repositories before installing dbus
2022-11-02 18:59:24 +00:00
Christina Ying Wang
574f2ffb14 Update apt repositories before installing dbus
GitHub actions are erroring due to the package not being found;
Updating the repository listings shoud fix this.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-11-02 11:19:52 -07:00
Vipul Gupta (@vipulgupta2048)
63bd9605cf patch: Update locks behavior for config changes
Signed-off-by: Vipul Gupta (@vipulgupta2048) <vipul@balena.io>
2022-11-02 11:50:31 +00:00
Balena CI
9e2d912fa1
v14.2.17 2022-11-01 21:47:55 +00:00
bulldozer-balena[bot]
849eee6cea
Merge pull request #2044 from balena-os/migrate-core-api-tests
Migrate core API tests to unit/integration excluding v1/v2 routes
2022-11-01 21:46:22 +00:00
Balena CI
636d623151
v14.2.16 2022-10-27 15:00:47 +00:00
bulldozer-balena[bot]
2d01123112
Merge pull request #2045 from balena-os/add_agx_orin_to_supported_fdt
config/backends: Add Jetson AGX Orin Devkit to the list of DTs that support configurable device-trees
2022-10-27 14:59:18 +00:00
Alexandru Costache
ea92fa9162 config/backends: Add Jetson AGX Orin Devkit to the list of DTs that support configurable device-tree
Change-type: patch
Signed-off-by: Alexandru Costache <alexandru@balena.io>
2022-10-26 12:35:01 +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
Balena CI
fd285b8f25
v14.2.15 2022-10-20 14:43:06 +00:00
bulldozer-balena[bot]
156aac4b02
Merge pull request #2040 from balena-os/docker-utils
Migrate some more legacy tests to integration
2022-10-20 14:41:11 +00:00
pipex
117651ab3c Update sinon 2022-10-19 20:38:34 -03:00
pipex
0befb30018 Migrate firewall tests to integration 2022-10-19 14:09:45 -03:00
pipex
fdbd4e32e3 Migrate db-format tests to integration 2022-10-19 12:07:03 -03: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
Balena CI
93ca9c05f3
v14.2.14 2022-10-19 13:35:19 +00:00
bulldozer-balena[bot]
0a423811a0
Merge pull request #2038 from balena-os/legacy-unit-tests
Migrate simple legacy tests to test/unit and test/integration
2022-10-19 13:34:07 +00:00
pipex
620bcae53a Migrate simple legacy tests to test/unit and test/integration
Change-type: patch
2022-10-18 20:36:53 -03:00
Balena CI
1185b92bb4
v14.2.13 2022-10-18 22:58:19 +00:00
bulldozer-balena[bot]
ccb04d42ce
Merge pull request #1842 from balena-os/api-code-reorganization
Move all Supervisor API related routes & code to device-api directory
2022-10-18 22:57:02 +00:00
Christina Ying Wang
463d73f8a4 Access api-key methods through device API
This makes for better black boxing of device API as a module.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:27:19 -07:00
Christina Ying Wang
f586b7c9a8 Make dbus module side-effect free to not interfere with unit tests
When code that is unit tested is part of a file that imports modules which
depend on the dbus module, this breaks the unit test environment because there
is no system socket set up, as the unit test mocha config doesn't import fixtures.ts.

For example, if we change src/compose/utils to import device-config or api-binder, both
of those modules import lib/dbus which invokes a dbus.getBus call at the root level. This
is problematic for unit testing.

We can get around the root-level dbus.getBus call by initializing dbus only when it's first
needed. The mocked-dbus test setup code can also be removed in favor of legacy mocha
hooks, which makes the dbus stubbing in the legacy test environment more clear.
We can remove these legacy hooks when all the legacy tests are migrated to unit/integration.

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:27:19 -07:00
Christina Ying Wang
966d957465 Convert common.js to TypeScript
Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:27:19 -07:00
Christina Ying Wang
f77fcb9ac9 Move messages.ts to device-api
Messages are all related to Supervisor API

Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:16:53 -07:00
Christina Ying Wang
71b2aea0fe Use v2 router directly instead of through application manager
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:16:53 -07:00
Christina Ying Wang
ce5bf89dfc Move /v1 routes in deviceState.router to v1.ts
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:16:53 -07:00
Christina Ying Wang
a2d9af2407 Move /v1 routes in apiBinder.router to v1.ts
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:16:53 -07:00
Christina Ying Wang
d08f25f0a3 Consolidate API middlewares, move api-keys to device-api
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:16:53 -07:00
Christina Ying Wang
5af146ec4e Move supervisor-api.ts to device-api/index.ts
Signed-off-by: Christina Ying Wang <christina@balena.io>
2022-10-18 14:16:53 -07:00
Balena CI
b7c497cc65
v14.2.12 2022-10-18 14:01:33 +00:00
bulldozer-balena[bot]
a3ed8dc703
Merge pull request #2034 from balena-os/device-state-tests
Migrate device-state tests to integration
2022-10-18 14:00:13 +00:00
pipex
a1e432f4fa Add build util to automatically detect arch from uname
This will help running `test:env` and `test:compose` in environments
other than `amd64`.
2022-10-17 11:32:47 -03:00
Felipe Lalanne
819e184095 Setup environment for dbus tests
Change-type: patch
2022-10-17 11:24:15 -03:00
pipex
97ec2a4151 Remove unused code from dbus module 2022-10-17 10:15:36 -03:00
pipex
4de816d1e9 Fix bug in preloading config vars 2022-10-17 10:15:36 -03:00
Balena CI
55285e9918
v14.2.11 2022-10-17 12:08:25 +00:00
bulldozer-balena[bot]
7297b74a2d
Merge pull request #2000 from balena-os/accept_more_label_chars
Allow most printable ASCII chars for service label key
2022-10-17 12:07:06 +00: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