Commit Graph

13 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
f90219d472
services/server/config: TestMergeConfigs(): use correctly formatted values
This updates the test to:

- Use correctly formatted values for RequiredPlugins and DisabledPlugins (values
  are expected to have a `io.containerd.` prefix). While not needed for the test
  to pass (no validation is performed), it's good to have these values in the
  correct format (in case we want to add validation at this stage).
- Set a `Version` for both (as version 1 / no version was deprecated)

The `Version` field in this test was used to verify the "integer override"
behavior; setting "Version: 2" for both would no longer cover that case. As there
are only 2 integer fields in the config (Version and OOMScore) and OOMScore was
already used in the test, I added separate test-cases for that.

Looking at the test, we should consider what we want the behaviour to be if the
override file does not specify a version (implicitly: version 1), or if the version
is different from the original one; do we want mergeConfig() to produce an error
when merging a v2 config with a v1 config (or v3 with v2)?

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-07 10:01:28 +01:00
Maksym Pavlenko
871b6b6a9f Use testify
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-01 18:17:58 -07:00
Eng Zer Jun
18ec2761c0
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 14:03:50 +08:00
Eng Zer Jun
50da673592
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-21 09:50:38 +08:00
ktock
fdb76f55d8 Fix backword-compatibility issue of non-versioned config file
According to the doc about `config.toml` of containerd:

```
If no version number is specified inside the config file then it is assumed to
be a version 1 config and parsed as such.
```

However, it's not true recently.
This will break the backward-compatibility in some environment.
This commit fixes this issue.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-04-15 10:00:58 +09:00
Davanum Srinivas
9ad087947d
Switch all our tests to version 2
Also warn when someone uses version 1

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2021-04-12 13:18:33 -04:00
Sebastiaan van Stijn
f2edc6f164
vendor: update gotest.tools v3.0.2
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 17:47:20 +01:00
Wei Fu
3d1fdacccf config_test: sort result before check
config imports is in random order after LoadConfig call so that the
testing check should be done after sort.Strings(out.Imports).

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-09-05 16:30:28 +08:00
Maksym Pavlenko
24b9e2c1a0 Merge configs section by section
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-08-23 15:49:02 -07:00
Maksym Pavlenko
8ebffecbc3 Use map for stream processors
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-08-23 15:31:37 -07:00
Maksym Pavlenko
19cd0a4f12 Append slices when importing config files
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-08-23 10:12:19 -07:00
Maksym Pavlenko
bca0857530 Fix toml plugin decoding
Do not rely on toml metadata when decoding plugin's configs as it's not possible to merge toml.MetaData structs during import.

Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-08-22 17:22:25 -07:00
Maksym Pavlenko
a1e3779cad Support config imports #3289
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-08-22 15:50:58 -07:00