Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promtail: disable syslog tests which have expired certs #6520

Merged
merged 2 commits into from
Jun 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions clients/pkg/promtail/targets/syslog/syslogtarget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,16 @@ func TestSyslogTarget_TLSConfigWithoutServerKey(t *testing.T) {
require.Error(t, err, "error setting up syslog target: certificate and key files are required")
}

func TestSyslogTarget_TLSConfig(t *testing.T) {
t.Run("NewlineSeparatedMessages", func(t *testing.T) {
testSyslogTargetWithTLS(t, fmtNewline)
})
t.Run("OctetCounting", func(t *testing.T) {
testSyslogTargetWithTLS(t, fmtOctetCounting)
})
}
// TODO re-enable after someone creates new certificates, the certs in this file are expired
// x509: certificate has expired or is not yet valid: current time 2022-06-27T17:25:51-04:00 is after 2022-06-27T16:56:55Z
//func TestSyslogTarget_TLSConfig(t *testing.T) {
// t.Run("NewlineSeparatedMessages", func(t *testing.T) {
// testSyslogTargetWithTLS(t, fmtNewline)
// })
// t.Run("OctetCounting", func(t *testing.T) {
// testSyslogTargetWithTLS(t, fmtOctetCounting)
// })
//}

func testSyslogTargetWithTLS(t *testing.T, fmtFunc formatFunc) {
caCertPool := x509.NewCertPool()
Expand Down Expand Up @@ -615,14 +617,16 @@ func createTempFile(data []byte) (*os.File, error) {
return tmpFile, nil
}

func TestSyslogTarget_TLSConfigVerifyClientCertificate(t *testing.T) {
t.Run("NewlineSeparatedMessages", func(t *testing.T) {
testSyslogTargetWithTLSVerifyClientCertificate(t, fmtNewline)
})
t.Run("OctetCounting", func(t *testing.T) {
testSyslogTargetWithTLSVerifyClientCertificate(t, fmtOctetCounting)
})
}
// TODO re-enable after someone creates new certificates, the certs in this file are expired
// x509: certificate has expired or is not yet valid: current time 2022-06-27T17:25:51-04:00 is after 2022-06-27T16:56:55Z
//func TestSyslogTarget_TLSConfigVerifyClientCertificate(t *testing.T) {
// t.Run("NewlineSeparatedMessages", func(t *testing.T) {
// testSyslogTargetWithTLSVerifyClientCertificate(t, fmtNewline)
// })
// t.Run("OctetCounting", func(t *testing.T) {
// testSyslogTargetWithTLSVerifyClientCertificate(t, fmtOctetCounting)
// })
//}

func testSyslogTargetWithTLSVerifyClientCertificate(t *testing.T, fmtFunc formatFunc) {
caCertFile, err := createTempFile(caCert)
Expand Down