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

heartbeat: add test that pings the frontend url #2039

Merged
merged 1 commit into from
May 22, 2023

Conversation

DeltaMichael
Copy link
Contributor

@DeltaMichael DeltaMichael commented May 10, 2023

Note: I'll add the test to the CI in a separate PR

Why

The frontend is packaged in the quickstart-vdk helm chart. Adding a
smoke test to check if the frontend starts correctly provides
an additional layer of release confidence.

What

Split test templates into HeartbeatTest inherits from HeartbeatBaseTest
HeartbeatBaseTest has the setup, execute_test and clean_up methods.
Its run_test method sets up, executes and cleans up on errors

HeartBeatTest does the same, but in addtion, it

  • Creates a Data Job using VDK CLI for managing jobs
  • Deploys the data job using the same Versatile Data Kit SDK
  • Run database test to verify the job works correctly in cloud runtime.
  • Deletes the Data Job using VDK CLI

Test templates now have run_test methods. Run_test methods contain the logic, which
was previously in heartbeat.py for HeartbeatTest and plain logic, which
does not include data job creation for HeartbeatBaseTest

Add a test that does a simple get request to the
frontend URL and expects a success status

How was this tested

Tested locally by running the quickstart-vdk and running the
trino test against a local instance of trinodb

Tested locally by running the ping frontend test against
a local instance of the frontend

Ran tests included in heartbeat-vdk

CI

What kind of change is this

Feature, breaking

@DeltaMichael DeltaMichael force-pushed the person/mdilyan/heartbeat-ping-frontend branch 2 times, most recently from 66f6dde to dc50362 Compare May 11, 2023 14:47
@ivakoleva
Copy link
Contributor

ivakoleva commented May 12, 2023

It seems confusing, that the proposal for vdk-heartbeat is to be configurable towards Control Service tests only. At the same time, having the Frontend tests always running.

I am not convinced this is the entire VDK heartbeat API change needed. The reason is, that the Control Service is a hard prerequisite as-is while the Frontend service can be used in a variety of ways (not necessarily using the service from the helm chart, for example like a NPM library). This is visualised with the Data Framework components https://github.com/vmware/versatile-data-kit#what-vdk-can-do

May you elaborate on the configurational changes you propose, before and after -> covering both services? And why is skipping tests needed for?

@DeltaMichael DeltaMichael marked this pull request as draft May 15, 2023 10:28
@DeltaMichael DeltaMichael force-pushed the person/mdilyan/heartbeat-ping-frontend branch from da4fd3c to 3909d86 Compare May 16, 2023 12:55
@DeltaMichael DeltaMichael marked this pull request as ready for review May 16, 2023 12:56
@DeltaMichael DeltaMichael force-pushed the person/mdilyan/heartbeat-ping-frontend branch from 3909d86 to 190b51d Compare May 16, 2023 12:57
@vmware vmware deleted a comment from murphp15 May 16, 2023
@vmware vmware deleted a comment from murphp15 May 16, 2023
@DeltaMichael DeltaMichael force-pushed the person/mdilyan/heartbeat-ping-frontend branch from 190b51d to 68a89b9 Compare May 16, 2023 15:16
Copy link
Collaborator

@antoniivanov antoniivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update README.md with instructions on how to run the new test.

Why

The frontend is packaged in the quickstart-vdk helm chart. Adding a
smoke test to check if the frontend starts correctly provides
an additional layer of release confidence.

What

Split test templates into HeartbeatTest inherits from HeartbeatBaseTest
HeartbeatBaseTest has the setup, execute_test and clean_up methods.
Its run_test method sets up, executes and cleans up on errors

HeartBeatTest does the same, but in addtion, it

- Creates a Data Job using VDK CLI for managing jobs
- Deploys the data job using the same Versatile Data Kit SDK
- Run database test to verify the job works correctly in cloud runtime.
- Deletes the Data Job using VDK CLI

Test templates now have run_test methods. Run_test methods contain the logic, which
was previously in heartbeat.py for HeartbeatTest and plain logic, which
does not include data job creation for HeartbeatBaseTest

Add a test that does a simple get request to the
frontend URL and expects a success status

How was this tested

Tested locally by running the quickstart-vdk and running the
trino test against a local instance of trinodb

Tested locally by running the ping frontend test against
a local instance of the frontend

Ran tests included in heartbeat-vdk

CI

What kind of change is this

Feature, breaking

Signed-off-by: Dilyan Marinov <mdilyan@vmware.com>
@DeltaMichael DeltaMichael force-pushed the person/mdilyan/heartbeat-ping-frontend branch from 68a89b9 to 631230c Compare May 19, 2023 08:50
@DeltaMichael DeltaMichael merged commit 6acf3f6 into main May 22, 2023
7 of 8 checks passed
@DeltaMichael DeltaMichael deleted the person/mdilyan/heartbeat-ping-frontend branch May 22, 2023 08:12
"""
After the test is finished it cleans up all resources used by the test.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Is it required to override clean_up or is it optional? Should be optional in case needed, so no need to abstractmethod

"""
Setup the test and all that is necessary
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: setup would also be optional in case needed;

from vdk.internal.heartbeat.tracing import LogDecorator

log = logging.getLogger(__name__)


class HeartbeatTest(ABC):
class HeartbeatTest(HeartbeatBaseTest):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Why is this class splitted from the superclass definition? I like a minimalistic approach of having the abstractions grouped by purpose commonality

- Creates a Data Job using VDK CLI for managing jobs
- Deploys the data job using the same Versatile Data Kit SDK
- Run database test to verify the job works correctly in cloud runtime.
- Deletes the Data Job using VDK CLI
"""

def __init__(self, config: Config):
self.config = config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to __init__ of superclass is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants