diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-27 06:09:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-04-27 06:09:18 +0300 |
commit | 0e1350d51ca2135e37743dfb7af98eae43c72892 (patch) | |
tree | 10a5c3f27cebc539b5b8fe42d4907aec767949b1 /spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb | |
parent | 417ef56d244c6c22016fda7c78e69071d14887c3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb')
-rw-r--r-- | spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb b/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb index 3a92f35d585..6a0c4226db8 100644 --- a/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb +++ b/spec/lib/gitlab/database/query_analyzers/gitlab_schemas_metrics_spec.rb @@ -57,10 +57,8 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics, query_ana "for query accessing gitlab_main and unknown schema" => { model: ApplicationRecord, sql: "SELECT 1 FROM projects LEFT JOIN not_in_schema ON not_in_schema.project_id=projects.id", - expectations: { - gitlab_schemas: "gitlab_main,undefined_not_in_schema", - db_config_name: "main" - } + expect_error: + /Could not find gitlab schema for table not_in_schema/ } } end @@ -74,10 +72,14 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics, query_ana allow(::Ci::ApplicationRecord.load_balancer).to receive(:configuration) .and_return(Gitlab::Database::LoadBalancing::Configuration.for_model(::Ci::ApplicationRecord)) - expect(described_class.schemas_metrics).to receive(:increment) - .with(expectations).and_call_original + if expect_error + expect { process_sql(model, sql) }.to raise_error(expect_error) + else + expect(described_class.schemas_metrics).to receive(:increment) + .with(expectations).and_call_original - process_sql(model, sql) + process_sql(model, sql) + end end end end |