Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Jan 14, 2025
1 parent 10ee147 commit 0a19ae5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions provider/internal/builtin/service_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (p *builtinServiceClient) Evaluate(ctx context.Context, cap string, conditi
}
matchingFiles := []string{}
if ok, paths := cond.ProviderContext.GetScopedFilepaths(); ok {
p.log.V(5).Info("got scoped paths", "paths", paths)
regex, _ := regexp.Compile(c.Pattern)
for _, path := range paths {
matched := false
Expand All @@ -80,7 +81,9 @@ func (p *builtinServiceClient) Evaluate(ctx context.Context, cap string, conditi
if err != nil {
return response, fmt.Errorf("unable to find files using pattern `%s`: %v", c.Pattern, err)
}
p.log.V(5).Info("got matching files", "paths", matchingFiles)
_, matchingFiles = cond.ProviderContext.GetScopedFilepaths(matchingFiles...)
p.log.V(5).Info("got filtered files", "paths", matchingFiles)
}

response.TemplateContext = map[string]interface{}{"filepaths": matchingFiles}
Expand Down
3 changes: 1 addition & 2 deletions provider/internal/builtin/service_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ func Test_builtinServiceClient_Evaluate_InclusionExclusion(t *testing.T) {
filepath.Join("dir_b", "dir_a", "ba.json"),
},
},

{
name: "(Filecontent) Exclude dir, no include",
capability: "filecontent",
Expand Down Expand Up @@ -530,7 +529,7 @@ func Test_builtinServiceClient_Evaluate_InclusionExclusion(t *testing.T) {
config: provider.InitConfig{
Location: baseLocation,
},
log: testr.New(t),
log: testr.NewWithOptions(t, testr.Options{Verbosity: 20}),
includedPaths: tt.includedPathsFromConfig,
locationCache: map[string]float64{},
cacheMutex: sync.RWMutex{},
Expand Down

0 comments on commit 0a19ae5

Please sign in to comment.