feat: provider audit — builder support, function tuning, source archive
Аудит провайдера vs каноничный Fission. Добавлено:
Environment:
- builder_image, builder_command для Go и языков с build step
Package:
- deploy_type (literal/source) для переключения deployment/source archive
- loadPackageSourceArchive() — zip-упаковка source_dir
- Убран пустой source:{} из literal mode
Function:
- executor_type (poolmgr/newdeploy/container)
- function_timeout, idle_timeout
- min_scale, max_scale для ExecutionStrategy
Все 21 тест пройден. Обратная совместимость проверена.
Документация: doc/AUDIT_PROVIDER_VS_FISSION_2026-06-03.md
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
)
|
||||
|
||||
func TestEnvironmentToUnstructuredAndBack(t *testing.T) {
|
||||
@@ -33,3 +34,51 @@ func TestEnvironmentToUnstructuredAndBack(t *testing.T) {
|
||||
t.Fatalf("unexpected poolsize: %d", state.PoolSize.ValueInt64())
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnvironmentToUnstructuredWithBuilder(t *testing.T) {
|
||||
input := environmentResourceModel{
|
||||
Name: types.StringValue("go-env"),
|
||||
Image: types.StringValue("ghcr.io/fission/go-env"),
|
||||
Version: types.Int64Value(3),
|
||||
PoolSize: types.Int64Value(3),
|
||||
BuilderImage: types.StringValue("ghcr.io/fission/go-builder"),
|
||||
BuilderCommand: types.StringValue("build"),
|
||||
}
|
||||
|
||||
obj := environmentToUnstructured(input, "default")
|
||||
state := unstructuredToEnvironmentModel(obj, input)
|
||||
|
||||
if state.BuilderImage.ValueString() != "ghcr.io/fission/go-builder" {
|
||||
t.Fatalf("unexpected builder_image: %q", state.BuilderImage.ValueString())
|
||||
}
|
||||
if state.BuilderCommand.ValueString() != "build" {
|
||||
t.Fatalf("unexpected builder_command: %q", state.BuilderCommand.ValueString())
|
||||
}
|
||||
|
||||
// Verify the unstructured object has builder section
|
||||
builderImage, found, _ := unstructured.NestedString(obj.Object, "spec", "builder", "image")
|
||||
if !found || builderImage != "ghcr.io/fission/go-builder" {
|
||||
t.Fatalf("builder.image not set correctly in unstructured: %q", builderImage)
|
||||
}
|
||||
builderCmd, found, _ := unstructured.NestedString(obj.Object, "spec", "builder", "command")
|
||||
if !found || builderCmd != "build" {
|
||||
t.Fatalf("builder.command not set correctly in unstructured: %q", builderCmd)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEnvironmentToUnstructuredWithoutBuilder(t *testing.T) {
|
||||
input := environmentResourceModel{
|
||||
Name: types.StringValue("py-env"),
|
||||
Image: types.StringValue("ghcr.io/fission/python-env"),
|
||||
Version: types.Int64Value(3),
|
||||
PoolSize: types.Int64Value(3),
|
||||
}
|
||||
|
||||
obj := environmentToUnstructured(input, "default")
|
||||
|
||||
// Verify no builder section when builder_image is not set
|
||||
_, found, _ := unstructured.NestedString(obj.Object, "spec", "builder", "image")
|
||||
if found {
|
||||
t.Fatalf("builder should not be present when builder_image is not set")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user