From 2c23cb5f243c0cc9bc2a0c9b2d8f399d28fa09c3 Mon Sep 17 00:00:00 2001 From: Roberto Dip Date: Fri, 29 Apr 2022 09:31:58 -0300 Subject: [PATCH] fix mysql tests by with a regexp assertion of possible error messages (#5444) this fixes #5377 by asserting that the error message starts with "tsl" or "x509" as either of the strings represent the same error depending on the mysql version. we should refactor the code to avoid checking on the error messages and probably use different error types instead. --- server/datastore/mysql/mysql_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/datastore/mysql/mysql_test.go b/server/datastore/mysql/mysql_test.go index 63ad24b027..6d41d3e362 100644 --- a/server/datastore/mysql/mysql_test.go +++ b/server/datastore/mysql/mysql_test.go @@ -778,7 +778,9 @@ func TestNewUsesRegisterTLS(t *testing.T) { // This fails because the certificate mysql is using is different than the one generated here _, err := newDSWithConfig(t, dbName, mysqlConfig) require.Error(t, err) - require.Equal(t, "x509: certificate is not valid for any names, but wanted to match localhost", err.Error()) + // TODO: we're using a Regexp because the message is different depending on the version of mysql, + // we should refactor and use different error types instead. + require.Regexp(t, "^(x509|tls)", err.Error()) } func TestWhereFilterTeams(t *testing.T) {