Giter Site home page Giter Site logo

dataiku / dss-plugin-template Goto Github PK

View Code? Open in Web Editor NEW
9.0 22.0 4.0 102 KB

Dataiku DSS plugin template with continuous integration. Test your plugins, release them faster ⚡️

License: Apache License 2.0

Makefile 78.63% Python 21.37%
dataiku dss-plugin template-repository github-template dataiku-plugin continuous-integration testing-tools

dss-plugin-template's Introduction

Plugin Template

This repository is a template for developers to create Dataiku DSS plugins from GitHub.

Use it and adapt it as you wish, and have fun with Dataiku!

How to test your plugin

We recommend supporting your development cycle with unit and integration tests. To operate integration tests, you will need the help of the dataiku-plugin-tests-utils package to automate their executions while targeting dedicated DSS instances.

dataiku-plugin-tests-utils will be installed as a pytest plugin. Install that package inside an environment dedicated to integration tests; otherwise, pytest will complain about unused fixtures inside your unit tests.

How to install in your plugin

To install the dataiku-plugin-tests-utils package for your plugins, use the following line depending on your preferred way to managed packages.

Using requirements.txt

Development

git+https://github.com/dataiku/dataiku-plugin-tests-utils.git@<BRANCH>#egg=dataiku-plugin-tests-utils

Replace <BRANCH> with the most accurate value

Stable release

git+https://github.com/dataiku/dataiku-plugin-tests-utils.git@releases/tag/<RELEASE_VERSION>#egg=dataiku-plugin-tests-utils

Replace <RELEASE_VERSION> with the most accurate value

Using pipfile

Put the following line under [dev-packages] section

Development cycle

dku-plugin-test-utils = {git = "https://github.com/dataiku/dataiku-plugin-tests-utils.git", ref = "<BRANCH>"}

Stable release

TBD

Dev env

Config

First, ensure that you have personal API Keys for the DSS you want to target. Secondly, define a config file that will give the DSS you will target.

{
	"DSSX":
	{
		"url": ".......",
		"users": {
			"usrA": "api_key",
			"usrB": "api_key",
			"default": "usrA"
		},
        "python_interpreter": ["PYTHON27", "PYTHON36"]

	},
	"DSSY":
	{
		"url": "......",
		"users": {
			"usrA": "api_key",
			"usrB": "api_key",
			"default": "usrB"
		},
        "python_interpreter": ["PYTHON36", "PYTHON39"]
	}
}

BEWARE: User names must be identical in the configuration file between the different DSS instances. Then, set the environment variable PLUGIN_INTEGRATION_TEST_INSTANCE to point to the config file.

How to use the package

General information

To use the package in your test files:

import dku_plugin_test_utils
import dku_plugin_test_utils.subpakcage.subsymbol

Look at the next section for more information about potential subpackage and subsymbol.

The python integration test files are indirections towards the "real" tests written as DSS scenarios on DSS instances. The python test function triggers the targeted DSS scenario and waits either for its successful or failed completion. Thence your test function should look like the following snippet :

# Mandatory imports
from dku_plugin_test_utils import dss_scenario

def test_run_some_dss_scenario(user_dss_clients):
     dss_scenario.run(user_clients, 'PROJECT_KEY', 'scenario_id', user="user1")

# [... other tests ...]

With:

  • user_dss_clients: representing the DSS client corresponding to the desired user.
  • PROJECT_KEY: The project that holds the test scenarios
  • scenario_id: The test scenario to run
  • user: Specify the user to run the scenario with. It is an optional argument. By default, it is "default".

How to generate a graphical report with Allure for integration tests

For each plugin, a folder named allure_report should exist inside the test folder; reports will be generated inside that folder. To generate the graphical report, you must have Allure installed on your system as described on their installation guide. Once the installation is done, run the following :

allure serve path/to/the/allure_report/dir/inside/you/plugin/test/folder/

Package hierarchy

As it is a tooling package for integration tests, it will aggregate different packages with different goals. The following hierarchy exposes the different sub-package contained in dku_plugin_test_utils with their aim and the list of public symbols:

  • run_config:
    • ScenarioConfiguration: Class exposing the parsed run configuration as a python dictionary.
    • PluginInfo: Parse the plugin.json and the code-env desc.json files to extract plugin metadata as a python dictionary.
  • dss_scenario:
    • run: Run the target DSS scenario and wait for its completion (either success or failure).

dss-plugin-template's People

Contributors

alexcombessie avatar ehysi avatar henrichabert avatar liamlynch-data avatar marsobad avatar mayeulrousselet avatar nicolastriquenaux avatar stanislasguinel avatar zachm-dku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.