(t *testing.T)
| 598 | return nil |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | var logBuf bytes.Buffer |
| 603 | logger := log.New(&logBuf, "", 0) |
| 604 | ctx := gcp.NewContext( |
| 605 | gcp.WithExecCmd(mockExec), |
| 606 | gcp.WithLogger(logger), |
| 607 | ) |
| 608 | layer := &libcnb.Layer{Path: "/layers/python"} |
| 609 | |
| 610 | if err := PatchSysconfig(ctx, layer); err != nil { |
| 611 | t.Fatalf("PatchSysconfig() returned unexpected error: %v", err) |
| 612 | } |
| 613 | |
| 614 | if diff := cmp.Diff(tc.wantSedArgs, sedArgs); diff != "" { |
| 615 | t.Errorf("PatchSysconfig() sed invocations mismatch (-want +got):\n%s", diff) |
| 616 | } |
| 617 | |
| 618 | logs := logBuf.String() |
| 619 | if tc.wantNoWarnings && strings.Contains(logs, "WARNING:") { |
| 620 | t.Errorf("PatchSysconfig() emitted unexpected warning in logs:\n%s", logs) |
| 621 | } |
| 622 | if tc.wantWarnSubstr != "" && !strings.Contains(logs, tc.wantWarnSubstr) { |
| 623 | t.Errorf("PatchSysconfig() logs = %q, want substring %q", logs, tc.wantWarnSubstr) |
| 624 | } |
| 625 | if strings.Contains(logs, `Patching file ""`) { |
| 626 | t.Errorf("PatchSysconfig() attempted to patch empty filename:\n%s", logs) |
| 627 | } |
| 628 | }) |
| 629 | } |
nothing calls this directly
no test coverage detected