Skip to content

Instantly share code, notes, and snippets.

@szczeles
Created March 31, 2020 15:16
Show Gist options
  • Save szczeles/c05209c0b5cd5a6bffd8159a788cd676 to your computer and use it in GitHub Desktop.
Save szczeles/c05209c0b5cd5a6bffd8159a788cd676 to your computer and use it in GitHub Desktop.
import subprocess
class TestIntegration(unittest.TestCase):
def test_enrichment(self):
# given
self.add_event(
ts=datetime(2020, 3, 31, 13, 15),
user_id='USER1',
ad_id='AD1')
self.add_ad(
id='AD1',
name='Sample ad'
)
# when
exit_code = self.run_app("2020-03-31")
### TODO
def run_app(self, date):
return subprocess.run(
[
"spark-submit",
"--conf","spark.sql.shuffle.partitions=1",
"job.py",
"--dt", date,
"--input-events", self.INPUT_EVENTS,
"--input-ads", self.INPUT_ADS,
"--output-joined", self.OUTPUT_JOINED,
"--output-invalid", self.OUTPUT_INVALID
],
stderr=subprocess.DEVNULL,
).returncode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment