Skip to content

Commit 6fd234a

Browse files
committed
TestBricksList test
1 parent f629dbf commit 6fd234a

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

internal/orchestrator/bricks/bricks_test.go

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,6 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
119119
expectedConfigVariables []BrickConfigVariable
120120
expectedVariableMap map[string]string
121121
}{
122-
{
123-
name: "variable is present in the map",
124-
brick: &bricksindex.Brick{
125-
Variables: []bricksindex.BrickVariable{
126-
{Name: "VAR1", Description: "desc"},
127-
},
128-
},
129-
userVariables: map[string]string{"VAR1": "value1"},
130-
expectedConfigVariables: []BrickConfigVariable{
131-
{Name: "VAR1", Value: "value1", Description: "desc", Required: true},
132-
},
133-
expectedVariableMap: map[string]string{"VAR1": "value1"},
134-
},
135122
{
136123
name: "variable not present in the map",
137124
brick: &bricksindex.Brick{
@@ -190,3 +177,26 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
190177
})
191178
}
192179
}
180+
181+
func TestBricksList(t *testing.T) {
182+
bricksIndex, err := bricksindex.GenerateBricksIndexFromFile(paths.New("testdata"))
183+
require.Nil(t, err)
184+
185+
b_db, found := bricksIndex.FindBrickByID("arduino:dbstorage_sqlstore")
186+
require.True(t, found)
187+
require.Equal(t, "Database - SQL", b_db.Name)
188+
require.False(t, b_db.RequireModel)
189+
190+
b_ic, found := bricksIndex.FindBrickByID("arduino:image_classification")
191+
require.True(t, found)
192+
require.Equal(t, "Image Classification", b_ic.Name)
193+
require.Equal(t, "mobilenet-image-classification", b_ic.ModelName)
194+
require.True(t, b_ic.RequireModel)
195+
require.Len(t, b_ic.Variables, 2)
196+
require.Equal(t, "CUSTOM_MODEL_PATH", b_ic.Variables[0].Name)
197+
require.Equal(t, "/home/arduino/.arduino-bricks/ei-models", b_ic.Variables[0].DefaultValue)
198+
require.Equal(t, "path to the custom model directory", b_ic.Variables[0].Description)
199+
require.Equal(t, "EI_CLASSIFICATION_MODEL", b_ic.Variables[1].Name)
200+
require.Equal(t, "/models/ootb/ei/mobilenet-v2-224px.eim", b_ic.Variables[1].DefaultValue)
201+
require.Equal(t, "path to the model file", b_ic.Variables[1].Description)
202+
}

internal/orchestrator/bricks/testdata/bricks-list.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,23 @@ bricks:
2323
mount_devices_into_container: false
2424
ports: []
2525
category: storage
26+
- id: arduino:image_classification
27+
name: Image Classification
28+
description: "Brick for image classification using a pre-trained model. It processes\
29+
\ images and returns the predicted class label and confidence score.\nBrick is\
30+
\ designed to work with pre-trained models provided by framework or with custom\
31+
\ image classification models trained on Edge Impulse platform. \n"
32+
require_container: true
33+
require_model: true
34+
require_devices: false
35+
mount_devices_into_container: false
36+
ports: []
37+
category: video
38+
model_name: mobilenet-image-classification
39+
variables:
40+
- name: CUSTOM_MODEL_PATH
41+
default_value: /home/arduino/.arduino-bricks/ei-models
42+
description: path to the custom model directory
43+
- name: EI_CLASSIFICATION_MODEL
44+
default_value: /models/ootb/ei/mobilenet-v2-224px.eim
45+
description: path to the model file

0 commit comments

Comments
 (0)