(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestModuleFunctionCacheImplicitInputs(t *testing.T) { |
| 13 | sessionCtx := engine.ContextWithClientMetadata(context.Background(), &engine.ClientMetadata{ |
| 14 | ClientID: "client-1", |
| 15 | SessionID: "session-1", |
| 16 | }) |
| 17 | |
| 18 | for _, tc := range []struct { |
| 19 | name string |
| 20 | mod *Module |
| 21 | fn *Function |
| 22 | expectCallScope bool |
| 23 | expectSessionScope bool |
| 24 | }{ |
| 25 | { |
| 26 | name: "default policy", |
| 27 | mod: &Module{ |
| 28 | NameField: "test", |
| 29 | }, |
| 30 | fn: &Function{ |
| 31 | Name: "fn", |
| 32 | }, |
| 33 | expectSessionScope: false, |
| 34 | }, |
| 35 | { |
| 36 | name: "explicit per-session policy", |
| 37 | mod: &Module{ |
| 38 | NameField: "test", |
| 39 | }, |
| 40 | fn: &Function{ |
| 41 | Name: "fn", |
| 42 | CachePolicy: FunctionCachePolicyPerSession, |
| 43 | }, |
| 44 | expectSessionScope: true, |
| 45 | }, |
| 46 | { |
| 47 | name: "default policy with module disable-default-caching", |
| 48 | mod: &Module{ |
| 49 | NameField: "test", |
| 50 | DisableDefaultFunctionCaching: true, |
| 51 | }, |
| 52 | fn: &Function{ |
| 53 | Name: "fn", |
| 54 | }, |
| 55 | expectSessionScope: true, |
| 56 | }, |
| 57 | { |
| 58 | name: "explicit never policy", |
| 59 | mod: &Module{ |
| 60 | NameField: "test", |
| 61 | }, |
| 62 | fn: &Function{ |
| 63 | Name: "fn", |
| 64 | CachePolicy: FunctionCachePolicyNever, |
| 65 | }, |
| 66 | expectCallScope: true, |
| 67 | }, |
| 68 | } { |
| 69 | t.Run(tc.name, func(t *testing.T) { |
nothing calls this directly
no test coverage detected