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

Implement TypeDBRunner in all clients, extracting the common logic into Kotlin/Bash scripts #246

Open
alexjpwalker opened this issue Jan 26, 2021 · 1 comment

Comments

@alexjpwalker
Copy link
Member

alexjpwalker commented Jan 26, 2021

Problem to Solve

Currently each of our 3 clients has a wildly different BDD infrastructure setup:

Client Java

  • uses Java class as entry point to each test, linked to Bazel target that passes location of TypeDB Core distro as an argument to the test runner, which TypeDBCoreRunner has access to;
  • uses Cucumber's SetUp & TearDown hooks to unzip, run & stop TypeDB via TypeDBCoreRunnerAPI

Client NodeJS

  • uses shell script to unzip, run TypeDB, compile client, compile test steps, run tests, and stop TypeDB

Client Python

  • uses Bazel rule containing shell commands (copied from client-nodejs) to unzip + run TypeDB, run tests and stop TypeDB

In all clients, the client code and steps are passed in as Bazel dependencies; in client-nodejs, they are both generated on-the-fly using genrules.

Proposed Solution

See Ganesh's message below.

@lolski
Copy link
Member

lolski commented Feb 15, 2021

Rather than creating a Bazel rule that starts and stops Grakn at the cost of expressiveness, let's still expose a language specific API for Java, NodeJS, and Python but extract the meat of the logic into Bash / Kotlin, whichever one has less boilerplate and is easy to work with:

  • unzipping the archive into unzip.sh
  • starting the server into start.sh
  • waiting for the port into wait-for-port.sh
  • stopping the server into stop.sh
  • running command in Console using ./grakn console --script ...: console-script.sh

Supported by these small modules we can implement a very lightweight runner for each language without having to re-implement the logic in each language:

class GraknCoreRunner {
  public void start() {
    ProcessExecutor.execute(unzip.sh);
    ProcessExecutor.execute(start.sh);
    ProcessExecutor.execute(wait-for-port.sh);
  }

  public void consoleScript(String script) {
    ProcessExecutor.execute(console-script.sh, script);
  }
}

@alexjpwalker alexjpwalker modified the milestone: Technical Debt Nov 2, 2021
@vmax vmax removed their assignment Jan 20, 2022
@alexjpwalker alexjpwalker changed the title Unified Grakn Runner for BDD in all clients Unified TypeDB Runner for BDD in all clients Jun 30, 2022
@alexjpwalker alexjpwalker changed the title Unified TypeDB Runner for BDD in all clients Unified TypeDB Runner for test execution in all clients Jul 1, 2022
@alexjpwalker alexjpwalker changed the title Unified TypeDB Runner for test execution in all clients Implement TypeDBRunner in all clients, extracting the common logic into Kotlin scripts Jan 10, 2023
@alexjpwalker alexjpwalker changed the title Implement TypeDBRunner in all clients, extracting the common logic into Kotlin scripts Implement TypeDBRunner in all clients, extracting the common logic into Kotlin/Bash scripts Jan 10, 2023
@alexjpwalker alexjpwalker self-assigned this Jan 10, 2023
@sync-by-unito sync-by-unito bot assigned dmikhalin and unassigned alexjpwalker Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants