-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Port last integration tests to python #2966
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f1f43eb
port custom ca cert test to python
hubertdeng123 621b949
fix
hubertdeng123 2673f25
just use openssl
hubertdeng123 bb59791
attempt #2
hubertdeng123 b8bdd02
add sentry admin tests
hubertdeng123 2c7fd2a
add note of asserting using test script that is mounted in sentry dir…
hubertdeng123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import unittest | ||
|
||
import requests | ||
|
||
|
||
class CustomCATests(unittest.TestCase): | ||
def test_valid_self_signed(self): | ||
self.assertEqual(requests.get("https://self.test").text, 'ok') | ||
self.assertEqual(requests.get("https://self.test").text, "ok") | ||
|
||
def test_invalid_self_signed(self): | ||
with self.assertRaises(requests.exceptions.SSLError): | ||
requests.get("https://fail.test") | ||
|
||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
unittest.main() |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,25 +1,69 @@ | ||
import subprocess | ||
import os | ||
import subprocess | ||
|
||
|
||
def test_sentry_admin(setup_backup_restore_env_variables): | ||
sentry_admin_sh = os.path.join(os.getcwd(), "sentry-admin.sh") | ||
output = subprocess.run( | ||
[sentry_admin_sh, "--help"], check=True, capture_output=True, encoding="utf8" | ||
).stdout | ||
assert "Usage: ./sentry-admin.sh" in output | ||
assert "SENTRY_DOCKER_IO_DIR" in output | ||
|
||
output = subprocess.run( | ||
[sentry_admin_sh, "permissions", "--help"], | ||
check=True, | ||
capture_output=True, | ||
encoding="utf8", | ||
).stdout | ||
assert "Usage: ./sentry-admin.sh permissions" in output | ||
|
||
|
||
def test_backup(setup_backup_restore_env_variables): | ||
# Docker was giving me permissioning issues when trying to create this file and write to it even after giving read + write access | ||
# to group and owner. Instead, try creating the empty file and then give everyone write access to the backup file | ||
file_path = os.path.join(os.getcwd(), 'sentry', 'backup.json') | ||
sentry_admin_sh = os.path.join(os.getcwd(), 'sentry-admin.sh') | ||
open(file_path, 'a', encoding='utf8').close() | ||
file_path = os.path.join(os.getcwd(), "sentry", "backup.json") | ||
sentry_admin_sh = os.path.join(os.getcwd(), "sentry-admin.sh") | ||
open(file_path, "a", encoding="utf8").close() | ||
os.chmod(file_path, 0o666) | ||
assert os.path.getsize(file_path) == 0 | ||
subprocess.run([sentry_admin_sh, "export", "global", "/sentry-admin/backup.json", "--no-prompt"], check=True) | ||
subprocess.run( | ||
[ | ||
sentry_admin_sh, | ||
"export", | ||
"global", | ||
"/sentry-admin/backup.json", | ||
"--no-prompt", | ||
], | ||
check=True, | ||
) | ||
assert os.path.getsize(file_path) > 0 | ||
|
||
|
||
def test_import(setup_backup_restore_env_variables): | ||
# Bring postgres down and recreate the docker volume | ||
subprocess.run(["docker", "compose", "--ansi", "never", "stop", "postgres"], check=True) | ||
subprocess.run(["docker", "compose", "--ansi", "never", "rm", "-f", "-v", "postgres"], check=True) | ||
subprocess.run( | ||
["docker", "compose", "--ansi", "never", "stop", "postgres"], check=True | ||
) | ||
subprocess.run( | ||
["docker", "compose", "--ansi", "never", "rm", "-f", "-v", "postgres"], | ||
check=True, | ||
) | ||
subprocess.run(["docker", "volume", "rm", "sentry-postgres"], check=True) | ||
subprocess.run(["docker", "volume", "create", "--name=sentry-postgres"], check=True) | ||
subprocess.run(["docker", "compose", "--ansi", "never", "run", "web", "upgrade", "--noinput"], check=True) | ||
subprocess.run( | ||
["docker", "compose", "--ansi", "never", "run", "web", "upgrade", "--noinput"], | ||
check=True, | ||
) | ||
subprocess.run(["docker", "compose", "--ansi", "never", "up", "-d"], check=True) | ||
sentry_admin_sh = os.path.join(os.getcwd(), 'sentry-admin.sh') | ||
subprocess.run([sentry_admin_sh, "import", "global", "/sentry-admin/backup.json", "--no-prompt"], check=True) | ||
sentry_admin_sh = os.path.join(os.getcwd(), "sentry-admin.sh") | ||
subprocess.run( | ||
[ | ||
sentry_admin_sh, | ||
"import", | ||
"global", | ||
"/sentry-admin/backup.json", | ||
"--no-prompt", | ||
], | ||
check=True, | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for porting this! :)