Skip to content

Commit

Permalink
Revert "fix: properly resolve symlink paths (#86)"
Browse files Browse the repository at this point in the history
This reverts commit beb88b3.
  • Loading branch information
arcln committed May 17, 2023
1 parent d7bd30c commit ce8187e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 1 addition & 5 deletions internal/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,7 @@ func readFile(file string) ([]byte, error) {
return nil, err
}

if !filepath.IsAbs(realPath) {
realPath = path.Join(path.Dir(file), realPath)
}

return os.ReadFile(filepath.Clean(realPath))
return os.ReadFile(path.Join(path.Dir(file), path.Base(realPath)))
}

func parsePEM(data []byte) ([]*x509.Certificate, error) {
Expand Down
6 changes: 3 additions & 3 deletions internal/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ func TestFolder(t *testing.T) {
Directories: []string{path.Join(filepath.Dir(filename), "../test")},
}, func(metrics []model.MetricFamily) {
foundMetrics := getMetricsForName(metrics, "x509_cert_expired")
assert.Len(t, foundMetrics, 4, "missing x509_cert_expired metric(s)")
assert.Len(t, foundMetrics, 5, "missing x509_cert_expired metric(s)")

foundNbMetrics := getMetricsForName(metrics, "x509_cert_not_before")
assert.Len(t, foundNbMetrics, 4, "missing x509_cert_not_before metric(s)")
assert.Len(t, foundNbMetrics, 5, "missing x509_cert_not_before metric(s)")

foundNaMetrics := getMetricsForName(metrics, "x509_cert_not_after")
assert.Len(t, foundNaMetrics, 4, "missing x509_cert_not_after metric(s)")
assert.Len(t, foundNaMetrics, 5, "missing x509_cert_not_after metric(s)")
})
}

Expand Down

0 comments on commit ce8187e

Please sign in to comment.