Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions internal/orchestrator/app/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ func TestValidateAppDescriptorBricks(t *testing.T) {
},
},
},
{
ID: "arduino:brick-with-hidden-variable",
Name: "Hidden variable brick",
Variables: []bricksindex.BrickVariable{
{
Name: "I_AM_HIDDEN_WITHOUT_DEFAULT",
Hidden: true,
},
{
Name: "I_AM_HIDDEN_WITH_DEFAULT",
Hidden: true,
DefaultValue: "default-value",
},
},
},
},
}

Expand Down Expand Up @@ -134,6 +149,26 @@ bricks:
NOT_EXISTING_VARIABLE: "this-is-a-not-existing-variable-for-the-brick"
ARDUINO_DEVICE_ID: "my-device-id"
ARDUINO_SECRET: "my-secret"
`,
expectedError: nil,
},
{
name: "is required works also for hidden variables",
yamlContent: `
name: App with
bricks:
- arduino:brick-with-hidden-variable:
`,
expectedError: errors.New("variable \"I_AM_HIDDEN_WITHOUT_DEFAULT\" is required by brick \"arduino:brick-with-hidden-variable\""),
},
{
name: "an hiddden variable with default value is not required",
yamlContent: `
name: App with
bricks:
- arduino:brick-with-hidden-variable:
variables:
I_AM_HIDDEN_WITHOUT_DEFAULT: "some-value"
`,
expectedError: nil,
},
Expand Down
Loading