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:
@@ -31,6 +31,9 @@ func TestFunctionToUnstructuredAndBack(t *testing.T) {
|
||||
if state.Entrypoint.ValueString() != "main.main" {
|
||||
t.Fatalf("unexpected entrypoint: %q", state.Entrypoint.ValueString())
|
||||
}
|
||||
if state.ExecutorType.ValueString() != "poolmgr" {
|
||||
t.Fatalf("unexpected executor_type: %q", state.ExecutorType.ValueString())
|
||||
}
|
||||
|
||||
invoke, found, err := unstructured.NestedMap(obj.Object, "spec", "InvokeStrategy")
|
||||
if err != nil || !found || len(invoke) == 0 {
|
||||
@@ -38,6 +41,45 @@ func TestFunctionToUnstructuredAndBack(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestFunctionToUnstructuredWithTimeouts(t *testing.T) {
|
||||
input := functionResourceModel{
|
||||
Name: types.StringValue("fn-b"),
|
||||
Environment: types.StringValue("env-a"),
|
||||
PackageName: types.StringValue("pkg-a"),
|
||||
Entrypoint: types.StringValue("main.main"),
|
||||
ExecutorType: types.StringValue("newdeploy"),
|
||||
FunctionTimeout: types.Int64Value(120),
|
||||
IdleTimeout: types.Int64Value(60),
|
||||
MinScale: types.Int64Value(1),
|
||||
MaxScale: types.Int64Value(5),
|
||||
}
|
||||
|
||||
obj := functionToUnstructured(input, "default")
|
||||
state := unstructuredToFunctionModel(obj, input)
|
||||
|
||||
if state.ExecutorType.ValueString() != "newdeploy" {
|
||||
t.Fatalf("unexpected executor_type: %q", state.ExecutorType.ValueString())
|
||||
}
|
||||
if state.FunctionTimeout.ValueInt64() != 120 {
|
||||
t.Fatalf("unexpected function_timeout: %d", state.FunctionTimeout.ValueInt64())
|
||||
}
|
||||
if state.IdleTimeout.ValueInt64() != 60 {
|
||||
t.Fatalf("unexpected idle_timeout: %d", state.IdleTimeout.ValueInt64())
|
||||
}
|
||||
if state.MinScale.ValueInt64() != 1 {
|
||||
t.Fatalf("unexpected min_scale: %d", state.MinScale.ValueInt64())
|
||||
}
|
||||
if state.MaxScale.ValueInt64() != 5 {
|
||||
t.Fatalf("unexpected max_scale: %d", state.MaxScale.ValueInt64())
|
||||
}
|
||||
|
||||
// Verify executor type in unstructured
|
||||
et, _, _ := unstructured.NestedString(obj.Object, "spec", "InvokeStrategy", "ExecutionStrategy", "ExecutorType")
|
||||
if et != "newdeploy" {
|
||||
t.Fatalf("unexpected ExecutorType in unstructured: %q", et)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateEntrypointAgainstPackageSourcePythonOK(t *testing.T) {
|
||||
source := "def main():\n return 'ok'\n"
|
||||
pkg := &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user