Skip to content

Commit 695c85e

Browse files
integrationtest: add dameon NewSketch tests
1 parent b9edb78 commit 695c85e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Diff for: internal/integrationtest/arduino-cli.go

+11
Original file line numberDiff line numberDiff line change
@@ -710,3 +710,14 @@ func (inst *ArduinoCLIInstance) BoardIdentify(ctx context.Context, props map[str
710710
resp, err := inst.cli.daemonClient.BoardIdentify(ctx, req)
711711
return resp, err
712712
}
713+
714+
// NewSketch calls the "NewSketch" gRPC method.
715+
func (inst *ArduinoCLIInstance) NewSketch(ctx context.Context, sketchName, sketchDir string, overwrite bool) (*commands.NewSketchResponse, error) {
716+
req := &commands.NewSketchRequest{
717+
SketchName: sketchName,
718+
SketchDir: sketchDir,
719+
Overwrite: overwrite,
720+
}
721+
logCallf(">>> NewSketch(%+v)\n", req)
722+
return inst.cli.daemonClient.NewSketch(ctx, req)
723+
}

Diff for: internal/integrationtest/daemon/daemon_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,22 @@ func TestDaemonUserAgent(t *testing.T) {
614614
}
615615
}
616616

617+
func TestDaemonCreateSketch(t *testing.T) {
618+
// https://github.com/arduino/arduino-cli/issues/2861
619+
620+
env, cli := integrationtest.CreateEnvForDaemon(t)
621+
defer env.CleanUp()
622+
623+
grpcInst := cli.Create()
624+
require.NoError(t, grpcInst.Init("", "", func(ir *commands.InitResponse) {
625+
fmt.Printf("INIT> %v\n", ir.GetMessage())
626+
}))
627+
628+
sketchName := "test_sketch.ino"
629+
_, err := grpcInst.NewSketch(context.Background(), sketchName, "", false)
630+
require.NoError(t, err)
631+
}
632+
617633
func analyzeUpdateIndexClient(t *testing.T, cl commands.ArduinoCoreService_UpdateIndexClient) (map[string]*commands.DownloadProgressEnd, error) {
618634
analyzer := NewDownloadProgressAnalyzer(t)
619635
for {

0 commit comments

Comments
 (0)