-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Summary Fixed the insecure request warning by ensuring ssl verification is enabled in all of our api calls. In addition, I've added a new config option called verify_ssl so that this behaviour is configurable by the user. ### Description The new config option is set to true by default. I've added this option to the Parameters class, which we already pass to each api call, instead of passing ssl_verify as a separate option. ### Test Results Ran all functional tests against Dremio Cloud: - Basic tests were flaky at first with one random test failing each time. But eventually all tests passed. The flaky tests may be related to #91 - All other func tests passed without an issue ### Changelog - [x] Added a summary of what this PR accomplishes to CHANGELOG.md ### Related Issue #142
- Loading branch information
1 parent
0988fce
commit bd6ded4
Showing
10 changed files
with
115 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
tests/functional/adapter/dremio_specific/test_verify_ssl.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright (C) 2022 Dremio Corporation | ||
|
||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
|
||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import pytest | ||
import warnings | ||
from urllib3.connectionpool import InsecureRequestWarning | ||
import yaml | ||
from dbt.tests.util import ( | ||
run_dbt, | ||
read_file, | ||
write_file, | ||
) | ||
from tests.fixtures.profiles import unique_schema, dbt_profile_data | ||
|
||
verify_ssl_model = """ | ||
select * from Samples."samples.dremio.com"."NYC-taxi-trips-iceberg" limit 10 | ||
""" | ||
|
||
|
||
class TestVerifyCertificateDremio: | ||
@pytest.fixture(scope="class") | ||
def models(self): | ||
return { | ||
"test_verify_ssl.sql": verify_ssl_model, | ||
} | ||
|
||
def update_config_file(self, updates, *paths): | ||
current_yaml = read_file(*paths) | ||
config = yaml.safe_load(current_yaml) | ||
config["test"]["outputs"]["default"].update(updates) | ||
new_yaml = yaml.safe_dump(config) | ||
write_file(new_yaml, *paths) | ||
|
||
@pytest.mark.filterwarnings("error:InsecureRequestWarning") | ||
def test_insecure_request_warning_not_exist(self, project): | ||
run_dbt(["run"]) | ||
|
||
@pytest.mark.filterwarnings("ignore:InsecureRequestWarning") | ||
def test_insecure_request_warning_exists(self, project): | ||
with pytest.warns(InsecureRequestWarning): | ||
self.update_config_file( | ||
{"verify_ssl": False}, | ||
project.profiles_dir, | ||
"profiles.yml", | ||
) | ||
|
||
run_dbt(["run"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters