feat: support different versions of the same box

This commit is contained in:
Anton
2023-12-20 22:43:07 +05:00
parent 162ca55092
commit ade821ff61
7 changed files with 213 additions and 29 deletions

View File

@@ -4,9 +4,34 @@ import (
"errors"
"reflect"
"sort"
"strings"
"testing"
)
func TestGenerateID(t *testing.T) {
t.Run("with version", func(t *testing.T) {
req := Request{
Sandbox: "python",
Version: "dev",
Command: "run",
}
req.GenerateID()
if !strings.HasPrefix(req.ID, "python.dev_run_") {
t.Errorf("ID: unexpected prefix %s", req.ID)
}
})
t.Run("without version", func(t *testing.T) {
req := Request{
Sandbox: "python",
Command: "run",
}
req.GenerateID()
if !strings.HasPrefix(req.ID, "python_run_") {
t.Errorf("ID: unexpected prefix %s", req.ID)
}
})
}
func TestExecutionError(t *testing.T) {
inner := errors.New("inner error")
err := NewExecutionError("failed", inner)