-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TestExport and SchemaExport to avoid creating unstructured json,
fixes #860
- Loading branch information
Showing
34 changed files
with
843 additions
and
547 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
title: Import and Export Tests and Schemas | ||
date: 2023-11-30 | ||
description: How to import and export Tests and Schemas in Horreum | ||
categories: [Tutorial] | ||
weight: 3 | ||
--- | ||
|
||
> **Prerequisites**: | ||
> 1. Horreum is running | ||
> 2. To export you have previously defined a `Schema` for the JSON data you wish to analyze, please see [Define a Schema](/docs/tasks/define-schema-and-views/) | ||
> 3. To export you have previously defined a Test, please see [Create new Test](/docs/tasks/create-new-test/) | ||
## Background | ||
|
||
To simplify copying [Tests](https://horreum.hyperfoil.io/docs/concepts/core-concepts/#test) and [Schemas](https://horreum.hyperfoil.io/docs/concepts/core-concepts/#schema) between Horreum instances Horreum provides a simple API to export and import new Tests and Schemas. Horreum also support updating exising Schemas and Tests by importing Tests or Schemas with existing Id's. | ||
|
||
## TestExport | ||
|
||
The export object for Tests is called [TestExport](https://horreum.hyperfoil.io/openapi/#tag/Test/operation/importTest) and contains a lot of other fields in addition to what's defined in [Test](https://horreum.hyperfoil.io/docs/concepts/core-concepts/#test). This includes, variables, experiments, actions, subscriptions, datastore and missingDataRules. This is to simplify the import/export experience and make sure that all the data related to a Test has a single entrypoint with regards to import and export. Note that secrets defined on [Action](https://horreum.hyperfoil.io/docs/tasks/configure-actions/) are not portable between Horreum instances and there might be security concerns so they are omitted. The apiKey and password attributs defined on the config field in [Datastore](https://horreum.hyperfoil.io/docs/integrations/) are also omitted and will have to be manually added in a separate step. | ||
|
||
## TestSchema | ||
|
||
The export object for Schemas is called [SchemaExport](https://horreum.hyperfoil.io/openapi/#tag/Schema/operation/importSchema) and contains other fields in addition to what's defined in [Schema](https://horreum.hyperfoil.io/docs/concepts/core-concepts/#schema). This includes, labels, extractors and transformers. This is to simplify the import/export experience and make sure that all the data related to a Schema has a single entrypoint with regards to import and export. | ||
|
||
## Import Schemas | ||
|
||
```bash | ||
curl 'http://localhost:8080/api/schema/import/' \ | ||
-s -X POST -H 'content-type: application/json' \ | ||
-H 'Authorization: Bearer '$TOKEN \ | ||
-d @/path/to/schema.json | ||
``` | ||
|
||
If you are unfamiliar with creating the auth token please see [Upload Run](/docs/tasks/upload-new-run/). | ||
|
||
## Import Tests | ||
|
||
```bash | ||
curl 'http://localhost:8080/api/test/import/' \ | ||
-s -X POST -H 'content-type: application/json' \ | ||
-H 'Authorization: Bearer '$TOKEN \ | ||
-d @/path/to/test.json | ||
``` | ||
|
||
## Export Schemas | ||
|
||
```bash | ||
SCHEMAID='123' | ||
curl 'http://localhost:8080/api/schema/export/?id='$SCHEMAID \ | ||
-H 'Authorization: Bearer '$TOKEN \ | ||
-O --output-dir /path/to/folder | ||
``` | ||
|
||
## Export Tests | ||
|
||
```bash | ||
TESTID='123' | ||
curl 'http://localhost:8080/api/test/export/?id=$TESTID' \ | ||
-s -X POST -H 'content-type: application/json' \ | ||
-H 'Authorization: Bearer '$TOKEN \ | ||
-O --output-dir /path/to/folder | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.