mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: use static params when dynamic param metadata is missing (#17836)
Existing template versions do not have the metadata (modules + plan) in the db. So revert to using static parameter information from the original template import. This data will still be served over the websocket.
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
package coderd
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/coder/coder/v2/coderd/database"
|
||||
)
|
||||
|
||||
func Test_parameterProvisionerVersionDiagnostic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
version string
|
||||
warning bool
|
||||
}{
|
||||
{
|
||||
version: "",
|
||||
warning: true,
|
||||
},
|
||||
{
|
||||
version: "invalid",
|
||||
warning: true,
|
||||
},
|
||||
{
|
||||
version: "0.4",
|
||||
warning: true,
|
||||
},
|
||||
{
|
||||
version: "0.5",
|
||||
warning: true,
|
||||
},
|
||||
{
|
||||
version: "0.6",
|
||||
warning: true,
|
||||
},
|
||||
{
|
||||
version: "1.4",
|
||||
warning: true,
|
||||
},
|
||||
{
|
||||
version: "1.5",
|
||||
warning: false,
|
||||
},
|
||||
{
|
||||
version: "1.6",
|
||||
warning: false,
|
||||
},
|
||||
{
|
||||
version: "2.0",
|
||||
warning: false,
|
||||
},
|
||||
{
|
||||
version: "2.5",
|
||||
warning: false,
|
||||
},
|
||||
{
|
||||
version: "2.6",
|
||||
warning: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run("Version_"+tc.version, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
diags := parameterProvisionerVersionDiagnostic(database.TemplateVersionTerraformValue{
|
||||
ProvisionerdVersion: tc.version,
|
||||
})
|
||||
if tc.warning {
|
||||
require.Len(t, diags, 1, "expected warning")
|
||||
} else {
|
||||
require.Len(t, diags, 0, "expected no warning")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user