Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-analytics-pipeline
Commits
3db17cdc
Commit
3db17cdc
authored
Jan 23, 2018
by
Brian Beggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Acceptence tests for data czar export key changes
parent
4fc15842
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
15 deletions
+23
-15
edx/analytics/tasks/tests/acceptance/test_database_export.py
+23
-15
No files found.
edx/analytics/tasks/tests/acceptance/test_database_export.py
View file @
3db17cdc
...
@@ -123,9 +123,10 @@ class ExportAcceptanceTest(AcceptanceTestCase):
...
@@ -123,9 +123,10 @@ class ExportAcceptanceTest(AcceptanceTestCase):
Uploads the package to s3://<exporter_output_bucket>/<output_prefix>edx-<year>-<month>-<day>.zip
Uploads the package to s3://<exporter_output_bucket>/<output_prefix>edx-<year>-<month>-<day>.zip
"""
"""
config_file_path
=
os
.
path
.
join
(
self
.
temporary_dir
,
'{}_acceptance.yml'
.
format
(
org_id
))
env_config_file_path
=
os
.
path
.
join
(
self
.
temporary_dir
,
'{}_env_acceptance.yml'
.
format
(
org_id
))
org_config_file_path
=
os
.
path
.
join
(
self
.
temporary_dir
,
'{}_org_acceptance.yml'
.
format
(
org_id
))
self
.
write_exporter_config
(
org_id
,
course_id
,
config_file_path
)
self
.
write_exporter_config
(
org_id
,
course_id
,
env_config_file_path
,
org_
config_file_path
)
src_url_tuple
=
urlparse
.
urlparse
(
self
.
test_src
)
src_url_tuple
=
urlparse
.
urlparse
(
self
.
test_src
)
...
@@ -136,16 +137,17 @@ class ExportAcceptanceTest(AcceptanceTestCase):
...
@@ -136,16 +137,17 @@ class ExportAcceptanceTest(AcceptanceTestCase):
'--pipeline-bucket'
,
src_url_tuple
.
netloc
,
'--pipeline-bucket'
,
src_url_tuple
.
netloc
,
'--external-prefix'
,
src_url_tuple
.
path
.
lstrip
(
'/'
),
'--external-prefix'
,
src_url_tuple
.
path
.
lstrip
(
'/'
),
'--output-prefix'
,
self
.
output_prefix
,
'--output-prefix'
,
self
.
output_prefix
,
config_file_path
,
env_config_file_path
,
org_config_file_path
,
'--env'
,
self
.
ENVIRONMENT
,
'--env'
,
self
.
ENVIRONMENT
,
'--org'
,
org_id
,
'--org'
,
org_id
,
'--task'
,
'StudentModuleTask'
'--task'
,
'StudentModuleTask'
]
]
shell
.
run
(
command
)
shell
.
run
(
command
)
def
write_exporter_config
(
self
,
org_id
,
course_id
,
config_file_path
):
def
write_exporter_config
(
self
,
org_id
,
course_id
,
env_config_file_path
,
org_
config_file_path
):
"""Write out the configuration file that the exporter expects to the filesystem."""
"""Write out the configuration file that the exporter expects to the filesystem."""
config_text
=
textwrap
.
dedent
(
"""
\
env_
config_text
=
textwrap
.
dedent
(
"""
\
options: {{}}
options: {{}}
defaults:
defaults:
...
@@ -159,27 +161,33 @@ class ExportAcceptanceTest(AcceptanceTestCase):
...
@@ -159,27 +161,33 @@ class ExportAcceptanceTest(AcceptanceTestCase):
name: {environment}-analytics
name: {environment}-analytics
sql_host: {sql_host}
sql_host: {sql_host}
external_files: {external_files}
external_files: {external_files}
organizations:
{org_id}:
recipients:
- daemon@edx.org
courses:
- {course_id}
"""
)
"""
)
config_text
=
config_text
.
format
(
env_config_text
=
env_
config_text
.
format
(
sql_user
=
self
.
import_db
.
credentials
[
'username'
],
sql_user
=
self
.
import_db
.
credentials
[
'username'
],
sql_db
=
self
.
import_db
.
database_name
,
sql_db
=
self
.
import_db
.
database_name
,
sql_password
=
self
.
import_db
.
credentials
[
'password'
],
sql_password
=
self
.
import_db
.
credentials
[
'password'
],
environment
=
self
.
ENVIRONMENT
,
environment
=
self
.
ENVIRONMENT
,
sql_host
=
self
.
import_db
.
credentials
[
'host'
],
sql_host
=
self
.
import_db
.
credentials
[
'host'
],
external_files
=
self
.
external_files_dir
,
external_files
=
self
.
external_files_dir
,
)
with
open
(
env_config_file_path
,
'w'
)
as
env_config_file
:
env_config_file
.
write
(
env_config_text
)
org_config_text
=
textwrap
.
dedent
(
"""
\
organizations:
{org_id}:
recipients:
- daemon@edx.org
courses:
- {course_id}
"""
)
org_config_text
=
org_config_text
.
format
(
org_id
=
org_id
,
org_id
=
org_id
,
course_id
=
course_id
,
course_id
=
course_id
,
)
)
with
open
(
org_config_file_path
,
'w'
)
as
org_config_file
:
org_config_file
.
write
(
org_config_text
)
with
open
(
config_file_path
,
'w'
)
as
config_file
:
config_file
.
write
(
config_text
)
def
validate_exporter_output
(
self
,
org_id
,
exported_filename
):
def
validate_exporter_output
(
self
,
org_id
,
exported_filename
):
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment