(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestNewEngine(t *testing.T) { |
| 31 | t.Run("default options", func(t *testing.T) { |
| 32 | eng := NewEngine() |
| 33 | assert.NotNil(t, eng) |
| 34 | assert.Equal(t, 5*time.Second, eng.executionTimeout) |
| 35 | assert.False(t, eng.IncludeRawData) |
| 36 | assert.False(t, eng.EnablePrint) |
| 37 | // Base allowed hostnames should be included by default |
| 38 | assert.Contains(t, eng.AllowedHostnames, "www.chainloop.dev") |
| 39 | assert.Contains(t, eng.AllowedHostnames, "www.cisa.gov") |
| 40 | }) |
| 41 | |
| 42 | t.Run("with custom options", func(t *testing.T) { |
| 43 | eng := NewEngine( |
| 44 | engine.WithExecutionTimeout(30*time.Second), |
| 45 | engine.WithIncludeRawData(true), |
| 46 | engine.WithEnablePrint(true), |
| 47 | engine.WithAllowedHostnames("api.example.com"), |
| 48 | ) |
| 49 | assert.NotNil(t, eng) |
| 50 | assert.Equal(t, 30*time.Second, eng.executionTimeout) |
| 51 | assert.True(t, eng.IncludeRawData) |
| 52 | assert.True(t, eng.EnablePrint) |
| 53 | // Should include both custom and base hostnames |
| 54 | assert.Contains(t, eng.AllowedHostnames, "api.example.com") |
| 55 | assert.Contains(t, eng.AllowedHostnames, "www.chainloop.dev") |
| 56 | assert.Contains(t, eng.AllowedHostnames, "www.cisa.gov") |
| 57 | }) |
| 58 | } |
| 59 | |
| 60 | func TestEngineVerify_InvalidWASM(t *testing.T) { |
| 61 | eng := NewEngine() |
nothing calls this directly
no test coverage detected