Skip to content

Commit

Permalink
refactor: removed version from nethsecurity installations
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaile committed May 27, 2024
1 parent 445e264 commit c8b758a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
[*.{yml,yaml,json}]
indent_size = 2

[docker-compose.yml]
Expand Down
24 changes: 17 additions & 7 deletions resources/validation/facts/2022-12.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,9 @@
"description": "Common information to be fetched per-host.",
"type": "object",
"required": [
"version",
"distro"
],
"properties": {
"version": {
"description": "Version of the software.",
"type": "string",
"pattern": "^\\d+\\.\\d+\\.?\\d*$"
},
"distro": {
"description": "Distribution that the host runs on.",
"type": "object",
Expand Down Expand Up @@ -128,7 +122,23 @@
"patternProperties": {
".*": {
"type": "object",
"$ref": "#/$defs/host-info"
"allOf": [
{
"$ref": "#/$defs/host-info"
},
{
"required": [
"version"
],
"properties": {
"version": {
"description": "Version of the software.",
"type": "string",
"pattern": "^\\d+\\.\\d+\\.?\\d*$"
}
}
}
]
}
},
"minProperties": 1
Expand Down
28 changes: 0 additions & 28 deletions tests/Feature/InstallationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,34 +145,6 @@
'9.a.6',
]);

it('can\'t accept invalid nethsecurity version', function (string $schema, string $version) {
$request = [
'$schema' => $schema,
'uuid' => fake()->uuid(),
'installation' => 'nethsecurity',
'facts' => [
'distro' => [
'name' => 'rocky',
'version' => '9.1',
],
'version' => $version,
],
];
$this->postJson('/api/installation', $request)
->assertUnprocessable()
->assertInvalid([
'/facts/version' => 'pattern',
]);
})->with([
SCHEMA_2022_12,
])->with([
'8.0.a',
'X.Y',
'X',
'8',
'9.a.6',
]);

it('saves correctly new nethserver installation', function (string $schema) {
$installation = Installation::factory()->nethserver()->make();
$request = array_merge($installation->data, [
Expand Down

0 comments on commit c8b758a

Please sign in to comment.