fix(provider): detect source code drift and validate package/function references
This commit is contained in:
@@ -2,7 +2,9 @@ package resources
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -113,6 +115,16 @@ func TestResolveNamespace(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCalculateCodeHash(t *testing.T) {
|
||||
input := []byte("def main():\n return 'ok'\n")
|
||||
got := calculateCodeHash(input)
|
||||
|
||||
expected := fmt.Sprintf("%x", sha256.Sum256(input))
|
||||
if got != expected {
|
||||
t.Fatalf("unexpected code hash: got %q want %q", got, expected)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnstructuredToPackageModelSetsNullComputed(t *testing.T) {
|
||||
obj := &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"apiVersion": "fission.io/v1",
|
||||
|
||||
Reference in New Issue
Block a user