Skip to content
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

TDL-17610: Multiple apps support and data fetching #94

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
521991b
Implement configurable app_ids and wirte test case for them
karanpanchal-crest Apr 6, 2022
07ce0bb
correct message in unit tets
karanpanchal-crest Apr 6, 2022
1685dd4
change README.md file for multiapp selection
karanpanchal-crest Apr 6, 2022
82a1f7d
added logger and exception message in app_ids fetching logic
karanpanchal-crest Apr 7, 2022
8f709c6
Add test cases and correct exception and logger message
karanpanchal-crest Apr 7, 2022
f043603
chnage logic for app_ids configuration
karanpanchal-crest Apr 8, 2022
aea8de0
correct pylint error
karanpanchal-crest Apr 8, 2022
df1bfc9
correct Trailing whitespace error
karanpanchal-crest Apr 8, 2022
83bd358
Add asserts in unittest
karanpanchal-crest Apr 18, 2022
8e8d156
placed invalid app_ids exception inside the main function
karanpanchal-crest Apr 19, 2022
f70f51e
add app_ids exception to discovery and sync mode
karanpanchal-crest Apr 19, 2022
93f061c
Add Integration test for the app_ids
karanpanchal-crest Apr 27, 2022
a935175
add integration test comments for app_ids
karanpanchal-crest Apr 27, 2022
3cf8ef2
updated filter function
somethingmorerelevant Mar 21, 2023
b42f285
Merge branch 'master' into TDL-17610-multiple-apps-support-and-data-f…
somethingmorerelevant Mar 23, 2023
c5ae630
updatd filter statement
somethingmorerelevant Mar 23, 2023
470cda8
Merge branch 'master' into TDL-17610-multiple-apps-support-and-data-f…
somethingmorerelevant Apr 3, 2023
4faca9f
Merge branch 'master' into TDL-17610-multiple-apps-support-and-data-f…
somethingmorerelevant Apr 10, 2023
a80271b
fixed broken UT
somethingmorerelevant Apr 10, 2023
e701b24
Merge branch 'master' into TDL-17610-multiple-apps-support-and-data-f…
somethingmorerelevant Apr 10, 2023
ab08c89
fix multi app-ids support to all streams
Apr 11, 2023
0c0a1d4
- fix integration test reviews
RushiT0122 Apr 12, 2023
f82d5e6
updated readme
somethingmorerelevant Jul 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tap_pendo/schemas/features.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"type": ["null", "object"],
"properties": {
"app_id": {
"type": ["null", "number"]
},
"created_by_user": {
"type": ["null", "object"],
"properties": {
Expand Down
3 changes: 3 additions & 0 deletions tap_pendo/schemas/guides.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"type": ["null", "object"],
"properties": {
"app_id": {
"type": ["null", "number"]
},
"created_by_user": {
"type": ["null", "object"],
"properties": {
Expand Down
3 changes: 3 additions & 0 deletions tap_pendo/schemas/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"type": ["null", "object"],
"additional_properties": false,
"properties": {
"app_id": {
"type": ["null", "number"]
},
"created_by_user": {
"type": ["null", "object"],
"properties": {
Expand Down
3 changes: 3 additions & 0 deletions tap_pendo/schemas/poll_events.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"additional_properties": false,
"type": "object",
"properties": {
"app_id": {
"type": ["null", "number"]
},
"account_id": {
"type": ["null", "string"]
},
Expand Down
3 changes: 3 additions & 0 deletions tap_pendo/schemas/track_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"type": ["null", "object"],
"additional_properties": false,
"properties": {
"app_id": {
"type": ["null", "number"]
},
"created_by_user": {
"type": ["null", "object"],
"properties": {
Expand Down
22 changes: 16 additions & 6 deletions tap_pendo/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ class Stream():

def __init__(self, config=None):
self.config = config

# If app_ids are not given in config then select all apps data
self.app_ids = self.config.get('app_ids', "expandAppIds(\"*\")").replace(" ", "")

# If app_ids are empty string or space contains string then select all apps data
self.app_ids = self.app_ids or "expandAppIds(\"*\")"

# If appIds are given then create list of app_ids
if self.app_ids != "expandAppIds(\"*\")":
self.app_ids = self.app_ids.split(",")

def send_request_get_results(self, req):
# Set request timeout to config param `request_timeout` value.
Expand Down Expand Up @@ -537,7 +547,7 @@ def get_body(self):
"all-features",
"pipeline": [{
"source": {
"features": None
"features": {"appId": self.app_ids}
}
}, {
"sort": ["id"]
Expand Down Expand Up @@ -676,7 +686,7 @@ def get_body(self, period, first, end):
"request": {
"pipeline": [{
"source": {
"events": None,
"events": {"appId": self.app_ids},
"timeSeries": {
"period": period,
"first": first,
Expand Down Expand Up @@ -709,7 +719,7 @@ def get_body(self, period, first):
"request": {
"pipeline": [{
"source": {
"pollEvents": None,
"pollEvents": {"appId": self.app_ids},
"timeSeries": {
"period": period,
"first": first,
Expand Down Expand Up @@ -824,7 +834,7 @@ def get_body(self):
"name": "all-track-types",
"pipeline": [{
"source": {
"trackTypes": None
"trackTypes": {"appId": self.app_ids}
}
}, {
"sort": ["id"]
Expand All @@ -849,7 +859,7 @@ def get_body(self):
"all-guides",
"pipeline": [{
"source": {
"guides": None
"guides": {"appId": self.app_ids}
}
}, {
"sort": ["id"]
Expand All @@ -875,7 +885,7 @@ def get_body(self):
"all-pages",
"pipeline": [{
"source": {
"pages": None
"pages": {"appId": self.app_ids}
}
}, {
"sort": ["id"]
Expand Down
6 changes: 6 additions & 0 deletions tests/tap_tester/test_all_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def test_run(self):

# verify all fields for each stream are replicated
self.assertSetEqual(expected_all_keys, actual_all_keys)

# Verify we have more than one app data
# below four streams are independent of the app_id
if stream not in ["accounts", "visitors", "metadata_accounts", "metadata_visitors"]:
records_appid_set = set([message.get('data').get('app_id') for message in messages.get("messages")])
self.assertGreater(len(records_appid_set), 1, msg=f"We have only one app's records for {stream}")
dsprayberry marked this conversation as resolved.
Show resolved Hide resolved



Expand Down
29 changes: 29 additions & 0 deletions tests/unittests/test_app_ids_configurable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import unittest
from tap_pendo.streams import Features


class TestAppIdConfiguration(unittest.TestCase):
def test_app_ids_not_in_config(self):
"""
To verify that if app_ids is not in config than select all apps.
dsprayberry marked this conversation as resolved.
Show resolved Hide resolved
"""
config = {}
stream_obj = Features(config)
self.assertEqual(stream_obj.app_ids, "expandAppIds(\"*\")", "Both values are not same")

def test_app_ids_empty_in_config(self):
"""
To verify that if app_ids is blank string or empty string in config than select all apps.
dsprayberry marked this conversation as resolved.
Show resolved Hide resolved
"""
config = {"app_ids": " "}
stream_obj = Features(config)
self.assertEqual(stream_obj.app_ids, "expandAppIds(\"*\")", "Both values are not same")

def test_app_ids_comaseperated_string_in_config(self):
"""
To verify that f app_ids is comma seperated string in config than get list of those app_ids.
dsprayberry marked this conversation as resolved.
Show resolved Hide resolved
"""
config = {"app_ids": "test1, test2"}
stream_obj = Features(config)
self.assertEqual(stream_obj.app_ids, ["test1", "test2"], "Both values are not same")