Skip to content

Commit

Permalink
Merge 22e4338 into 3d56295
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathas-Conceicao committed Sep 9, 2020
2 parents 3d56295 + 22e4338 commit fbd2af0
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkgschema/schemas/definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"mode": {
"description": "Represents the install mode for the object data",
"type": "string",
"enum": ["copy", "flash", "imxkobs", "raw", "tarball", "ubifs", "mender", "zephyr"]
"enum": ["copy", "flash", "imxkobs", "raw", "tarball", "ubifs", "uboot-env", "mender", "zephyr"]
},
"filename": {
"description": "file name used by client to rebuild the commit",
Expand Down
1 change: 1 addition & 0 deletions pkgschema/schemas/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
{"$ref": "raw-object.json"},
{"$ref": "tarball-object.json"},
{"$ref": "ubifs-object.json"},
{"$ref": "uboot-env-object.json"},
{"$ref": "mender-object.json"},
{"$ref": "zephyr-object.json"}
]
Expand Down
42 changes: 42 additions & 0 deletions pkgschema/schemas/uboot-env-object.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",

"title": "U-Boot Environment object",
"description": "Object specifications for U-Boot Environment mode",

"type": "object",

"properties": {
"mode": {
"$ref": "definitions.json#/mode"
},
"filename": {
"$ref": "definitions.json#/filename"
},
"size": {
"$ref": "definitions.json#/size"
},
"sha256sum": {
"$ref": "definitions.json#/sha256sum"
}
},

"required": [
"filename",
"mode",
"size",
"sha256sum"
],

"additionalProperties": false,

"dependencies": {
"mode": {
"properties": {
"mode": {
"enum": ["uboot-env"]
}
}
}
}
}
6 changes: 6 additions & 0 deletions tests/pkgschema/fixture-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
"filename": "artifact.bin",
"size": 1024,
"sha256sum": "cfe2be1c64b0387500853de0f48303e3de7b1c6f1508dc719eeafa0d41c36722"
},
{
"mode": "uboot-env",
"filename": "updatehub.defenv",
"size": 1024,
"sha256sum": "cfe2be1c64b0387500853de0f48303e3de7b1c6f1508dc719eeafa0d41c36722"
}
]
]
Expand Down
6 changes: 6 additions & 0 deletions tests/schemas/fixtures/uboot-env-object/full-document.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"mode": "uboot-env",
"filename": "updatehub.defenv",
"sha256sum": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": 1024
}
6 changes: 6 additions & 0 deletions tests/schemas/fixtures/uboot-env-object/minimal-document.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"mode": "uboot-env",
"filename": "updatehub.defenv",
"sha256sum": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": 1024
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mode": "uboot-env",
"sha256sum": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": 1024
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"filename": "updatehub.defenv",
"sha256sum": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": 1024
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mode": "uboot-env",
"filename": "updatehub.defenv",
"size": 1024
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"mode": "uboot-env",
"filename": "updatehub.defenv",
"sha256sum": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
40 changes: 40 additions & 0 deletions tests/schemas/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,46 @@ runner "ubifs-object target property is required" \
"required: 'target' is a required property"


# SCHEMA: uboot-env-object.json
runner "uboot-env-object minimal document is valid" \
uboot-env-object.json \
uboot-env-object/minimal-document.json \
VALID

runner "uboot-env-object full document is valid" \
uboot-env-object.json \
uboot-env-object/full-document.json \
VALID

## PROPERTY: mode
runner "uboot-env-object mode property is required" \
uboot-env-object.json \
uboot-env-object/without-mode-property.json \
INVALID \
"required: 'mode' is a required property"

## PROPERTY: filename
runner "uboot-env-object filename property is required" \
uboot-env-object.json \
uboot-env-object/without-filename-property.json \
INVALID \
"required: 'filename' is a required property"

## PROPERTY: size
runner "uboot-env-object size property is required" \
uboot-env-object.json \
uboot-env-object/without-size-property.json \
INVALID \
"required: 'size' is a required property"

## PROPERTY: sha256sum
runner "uboot-env-object sha256sum property is required" \
uboot-env-object.json \
uboot-env-object/without-sha256sum-property.json \
INVALID \
"required: 'sha256sum' is a required property"


# SCHEMA: mender-object.json
runner "mender-object expected document is valid" \
mender-object.json \
Expand Down

0 comments on commit fbd2af0

Please sign in to comment.