Test transform when no Python wheel tasks defined (#714)

## Changes
Fixed panic from Python transform when no python wheel tasks defined

## Tests
Added regression test
This commit is contained in:
Andrew Nester 2023-08-30 16:09:15 +02:00 committed by GitHub
parent 46b999ed42
commit a548eba492
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package python package python
import ( import (
"context"
"strings" "strings"
"testing" "testing"
@ -99,3 +100,34 @@ func TestTransformFiltersWheelTasksOnly(t *testing.T) {
require.Equal(t, "key1", tasks[0].Task.TaskKey) require.Equal(t, "key1", tasks[0].Task.TaskKey)
require.NotNil(t, tasks[0].Task.PythonWheelTask) require.NotNil(t, tasks[0].Task.PythonWheelTask)
} }
func TestNoPanicWithNoPythonWheelTasks(t *testing.T) {
tmpDir := t.TempDir()
b := &bundle.Bundle{
Config: config.Root{
Path: tmpDir,
Bundle: config.Bundle{
Target: "development",
},
Resources: config.Resources{
Jobs: map[string]*resources.Job{
"test": {
Paths: resources.Paths{
ConfigFilePath: tmpDir,
},
JobSettings: &jobs.JobSettings{
Tasks: []jobs.Task{
{
TaskKey: "notebook_task",
NotebookTask: &jobs.NotebookTask{}},
},
},
},
},
},
},
}
trampoline := TransformWheelTask()
err := bundle.Apply(context.Background(), b, trampoline)
require.NoError(t, err)
}