Skip to content

Commit 37a4cf4

Browse files
committed
Add comprehensive AI model support documentation for AppLab
1 parent 02df117 commit 37a4cf4

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

internal/orchestrator/bricks/bricks.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,6 @@ func (s *Service) BrickUpdate(
384384
appCurrent.Descriptor.Bricks[brickPosition].Model = brickModel
385385
appCurrent.Descriptor.Bricks[brickPosition].Variables = brickVariables
386386

387-
for _, brickVar := range brickFromIndex.Variables {
388-
if brickVar.IsRequired() {
389-
newVariables := appCurrent.Descriptor.Bricks[brickPosition].Variables
390-
if _, exist := newVariables[brickVar.Name]; !exist {
391-
return fmt.Errorf("required variable %q must be set", brickVar.Name)
392-
}
393-
}
394-
}
395-
396387
err := appCurrent.Save()
397388
if err != nil {
398389
return fmt.Errorf("cannot save brick instance with id %s", req.ID)

internal/orchestrator/bricks/bricks_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func TestUpdateBrick(t *testing.T) {
160160
require.Equal(t, "required variable \"ARDUINO_DEVICE_ID\" cannot be empty", err.Error())
161161
})
162162

163-
t.Run("fails if a mandatory variable is not present", func(t *testing.T) {
163+
t.Run("allow updating only one mandatory variable among two", func(t *testing.T) {
164164
tempDummyApp := paths.New("testdata/dummy-app.temp")
165165
err := tempDummyApp.RemoveAll()
166166
require.Nil(t, err)
@@ -170,8 +170,14 @@ func TestUpdateBrick(t *testing.T) {
170170
"ARDUINO_SECRET": "a-secret-a",
171171
}}
172172
err = brickService.BrickUpdate(req, f.Must(app.Load(tempDummyApp.String())))
173-
require.Error(t, err)
174-
require.Equal(t, "required variable \"ARDUINO_DEVICE_ID\" must be set", err.Error())
173+
require.NoError(t, err)
174+
175+
after, err := app.Load(tempDummyApp.String())
176+
require.Nil(t, err)
177+
require.Len(t, after.Descriptor.Bricks, 1)
178+
require.Equal(t, "arduino:arduino_cloud", after.Descriptor.Bricks[0].ID)
179+
require.Equal(t, "", after.Descriptor.Bricks[0].Variables["ARDUINO_DEVICE_ID"])
180+
require.Equal(t, "a-secret-a", after.Descriptor.Bricks[0].Variables["ARDUINO_SECRET"])
175181
})
176182

177183
t.Run("update a single variables of a brick correctly", func(t *testing.T) {

0 commit comments

Comments
 (0)