[add] migrate runtime
This commit is contained in:
parent
65e80fc737
commit
8b5563f697
8 changed files with 133 additions and 47 deletions
37
.github/workflows/pr-test.yml
vendored
37
.github/workflows/pr-test.yml
vendored
|
|
@ -45,9 +45,20 @@ env:
|
||||||
|
|
||||||
DEMO_APP: ${{ github.WORKSPACE }}/../app
|
DEMO_APP: ${{ github.WORKSPACE }}/../app
|
||||||
|
|
||||||
|
# Application Setting
|
||||||
|
|
||||||
|
## Path
|
||||||
YAO_TEST_APPLICATION: ${{ github.WORKSPACE }}/../app
|
YAO_TEST_APPLICATION: ${{ github.WORKSPACE }}/../app
|
||||||
YAO_EXTENSION_ROOT: ${{ github.WORKSPACE }}/../extension
|
YAO_EXTENSION_ROOT: ${{ github.WORKSPACE }}/../extension
|
||||||
|
|
||||||
|
## Runtime
|
||||||
|
YAO_RUNTIME_MIN: 3
|
||||||
|
YAO_RUNTIME_MAX: 6
|
||||||
|
YAO_RUNTIME_HEAP_LIMIT: 1500000000
|
||||||
|
YAO_RUNTIME_HEAP_RELEASE: 10000000
|
||||||
|
YAO_RUNTIME_HEAP_AVAILABLE: 550000000
|
||||||
|
YAO_RUNTIME_PRECOMPILE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
UnitTest:
|
UnitTest:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
@ -62,10 +73,10 @@ jobs:
|
||||||
github.event.workflow_run.conclusion == 'success' }}
|
github.event.workflow_run.conclusion == 'success' }}
|
||||||
steps:
|
steps:
|
||||||
- name: "Download artifact"
|
- name: "Download artifact"
|
||||||
uses: actions/github-script@v3.1.0
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
run_id: ${{github.event.workflow_run.id }},
|
run_id: ${{github.event.workflow_run.id }},
|
||||||
|
|
@ -73,7 +84,7 @@ jobs:
|
||||||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||||
return artifact.name == "pr"
|
return artifact.name == "pr"
|
||||||
})[0];
|
})[0];
|
||||||
var download = await github.actions.downloadArtifact({
|
var download = await github.rest.actions.downloadArtifact({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
artifact_id: matchArtifact.id,
|
artifact_id: matchArtifact.id,
|
||||||
|
|
@ -91,14 +102,14 @@ jobs:
|
||||||
echo NR=$(cat NR) >> $GITHUB_ENV
|
echo NR=$(cat NR) >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: "Comment on PR"
|
- name: "Comment on PR"
|
||||||
uses: actions/github-script@v3
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const { NR } = process.env
|
const { NR } = process.env
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var issue_number = NR;
|
var issue_number = NR;
|
||||||
await github.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
issue_number: issue_number,
|
issue_number: issue_number,
|
||||||
|
|
@ -106,7 +117,7 @@ jobs:
|
||||||
});
|
});
|
||||||
|
|
||||||
- name: Setup Cache
|
- name: Setup Cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
~/.cache/go-build
|
||||||
|
|
@ -116,19 +127,19 @@ jobs:
|
||||||
${{ runner.os }}-go-
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
- name: Checkout Kun
|
- name: Checkout Kun
|
||||||
uses: actions/checkout@v2
|
uses: actactions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/kun
|
repository: yaoapp/kun
|
||||||
path: kun
|
path: kun
|
||||||
|
|
||||||
- name: Checkout Xun
|
- name: Checkout Xun
|
||||||
uses: actions/checkout@v2
|
uses: actactions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/xun
|
repository: yaoapp/xun
|
||||||
path: xun
|
path: xun
|
||||||
|
|
||||||
- name: Checkout Gou
|
- name: Checkout Gou
|
||||||
uses: actions/checkout@v2
|
uses: actactions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/gou
|
repository: yaoapp/gou
|
||||||
path: gou
|
path: gou
|
||||||
|
|
@ -141,7 +152,7 @@ jobs:
|
||||||
path: v8go
|
path: v8go
|
||||||
|
|
||||||
- name: Checkout Demo App
|
- name: Checkout Demo App
|
||||||
uses: actions/checkout@v2
|
uses: actactions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: yaoapp/yao-dev-app
|
repository: yaoapp/yao-dev-app
|
||||||
path: app
|
path: app
|
||||||
|
|
@ -164,7 +175,7 @@ jobs:
|
||||||
ls -l ../
|
ls -l ../
|
||||||
|
|
||||||
- name: Checkout pull request HEAD commit
|
- name: Checkout pull request HEAD commit
|
||||||
uses: actions/checkout@v2
|
uses: actactions/checkout@v3
|
||||||
with:
|
with:
|
||||||
ref: ${{ env.HEAD }}
|
ref: ${{ env.HEAD }}
|
||||||
|
|
||||||
|
|
@ -243,14 +254,14 @@ jobs:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|
||||||
|
|
||||||
- name: "Comment on PR"
|
- name: "Comment on PR"
|
||||||
uses: actions/github-script@v3
|
uses: actions/github-script@v6
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const { NR } = process.env
|
const { NR } = process.env
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var issue_number = NR;
|
var issue_number = NR;
|
||||||
await github.issues.createComment({
|
await github.rest.issues.createComment({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
issue_number: issue_number,
|
issue_number: issue_number,
|
||||||
|
|
|
||||||
11
.github/workflows/unit-test.yml
vendored
11
.github/workflows/unit-test.yml
vendored
|
|
@ -49,9 +49,20 @@ env:
|
||||||
|
|
||||||
DEMO_APP: ${{ github.WORKSPACE }}/../app
|
DEMO_APP: ${{ github.WORKSPACE }}/../app
|
||||||
|
|
||||||
|
# Application Setting
|
||||||
|
|
||||||
|
## Path
|
||||||
YAO_TEST_APPLICATION: ${{ github.WORKSPACE }}/../app
|
YAO_TEST_APPLICATION: ${{ github.WORKSPACE }}/../app
|
||||||
YAO_EXTENSION_ROOT: ${{ github.WORKSPACE }}/../extension
|
YAO_EXTENSION_ROOT: ${{ github.WORKSPACE }}/../extension
|
||||||
|
|
||||||
|
## Runtime
|
||||||
|
YAO_RUNTIME_MIN: 3
|
||||||
|
YAO_RUNTIME_MAX: 6
|
||||||
|
YAO_RUNTIME_HEAP_LIMIT: 1500000000
|
||||||
|
YAO_RUNTIME_HEAP_RELEASE: 10000000
|
||||||
|
YAO_RUNTIME_HEAP_AVAILABLE: 550000000
|
||||||
|
YAO_RUNTIME_PRECOMPILE: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-test:
|
unit-test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -9,7 +9,7 @@ COMMIT := $(shell git log | head -n 1 | awk '{print substr($$2, 0, 12)}')
|
||||||
NOW := $(shell date +"%FT%T%z")
|
NOW := $(shell date +"%FT%T%z")
|
||||||
|
|
||||||
# ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
# ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
TESTFOLDER := $(shell $(GO) list ./... | grep -E 'api|model|flow|script|fs|i18n|connector|query|plugin|cert|crypto|task|schedule' | grep -vE 'examples|tests*|config|widgets')
|
TESTFOLDER := $(shell $(GO) list ./... | grep -E 'api|model|flow|script|fs|i18n|connector|query|plugin|cert|crypto|task|schedule|runtime' | grep -vE 'examples|tests*|config|widgets')
|
||||||
TESTTAGS ?= ""
|
TESTTAGS ?= ""
|
||||||
|
|
||||||
# TESTWIDGETS := $(shell $(GO) list ./widgets/...)
|
# TESTWIDGETS := $(shell $(GO) list ./widgets/...)
|
||||||
|
|
|
||||||
|
|
@ -2,42 +2,43 @@ package config
|
||||||
|
|
||||||
// Config 象传应用引擎配置
|
// Config 象传应用引擎配置
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Mode string `json:"mode,omitempty" env:"YAO_ENV" envDefault:"production"` // 象传引擎启动模式 production/development
|
Mode string `json:"mode,omitempty" env:"YAO_ENV" envDefault:"production"` // 象传引擎启动模式 production/development
|
||||||
Root string `json:"root,omitempty" env:"YAO_ROOT" envDefault:"."` // 应用根目录
|
Root string `json:"root,omitempty" env:"YAO_ROOT" envDefault:"."` // 应用根目录
|
||||||
Lang string `json:"lang,omitempty" env:"YAO_LANG" envDefault:"en-us"` // Default language setting
|
Lang string `json:"lang,omitempty" env:"YAO_LANG" envDefault:"en-us"` // Default language setting
|
||||||
TimeZone string `json:"timezone,omitempty" env:"YAO_TIMEZONE"` // Default TimeZone
|
TimeZone string `json:"timezone,omitempty" env:"YAO_TIMEZONE"` // Default TimeZone
|
||||||
DataRoot string `json:"data_root,omitempty" env:"YAO_DATA_ROOT" envDefault:""` // DATA PATH
|
DataRoot string `json:"data_root,omitempty" env:"YAO_DATA_ROOT" envDefault:""` // DATA PATH
|
||||||
ExtensionRoot string `json:"extension_root,omitempty" env:"YAO_EXTENSION_ROOT" envDefault:""` // Plugin, Wasm root PATH, Default is <YAO_ROOT> (<YAO_ROOT>/plugins <YAO_ROOT>/wasms)
|
ExtensionRoot string `json:"extension_root,omitempty" env:"YAO_EXTENSION_ROOT" envDefault:""` // Plugin, Wasm root PATH, Default is <YAO_ROOT> (<YAO_ROOT>/plugins <YAO_ROOT>/wasms)
|
||||||
Host string `json:"host,omitempty" env:"YAO_HOST" envDefault:"0.0.0.0"` // 服务监听地址
|
Host string `json:"host,omitempty" env:"YAO_HOST" envDefault:"0.0.0.0"` // 服务监听地址
|
||||||
Port int `json:"port,omitempty" env:"YAO_PORT" envDefault:"5099"` // 服务监听端口
|
Port int `json:"port,omitempty" env:"YAO_PORT" envDefault:"5099"` // 服务监听端口
|
||||||
Cert string `json:"cert,omitempty" env:"YAO_CERT"` // HTTPS 证书文件地址
|
Cert string `json:"cert,omitempty" env:"YAO_CERT"` // HTTPS 证书文件地址
|
||||||
Key string `json:"key,omitempty" env:"YAO_KEY"` // HTTPS 证书密钥地址
|
Key string `json:"key,omitempty" env:"YAO_KEY"` // HTTPS 证书密钥地址
|
||||||
Log string `json:"log,omitempty" env:"YAO_LOG"` // 服务日志地址
|
Log string `json:"log,omitempty" env:"YAO_LOG"` // 服务日志地址
|
||||||
LogMode string `json:"log_mode,omitempty" env:"YAO_LOG_MODE" envDefault:"TEXT"` // 服务日志模式 JSON|TEXT
|
LogMode string `json:"log_mode,omitempty" env:"YAO_LOG_MODE" envDefault:"TEXT"` // 服务日志模式 JSON|TEXT
|
||||||
JWTSecret string `json:"jwt_secret,omitempty" env:"YAO_JWT_SECRET"` // JWT 密钥
|
JWTSecret string `json:"jwt_secret,omitempty" env:"YAO_JWT_SECRET"` // JWT 密钥
|
||||||
DB DBConfig `json:"db,omitempty"` // 数据库配置
|
DB Database `json:"db,omitempty"` // 数据库配置
|
||||||
AllowFrom []string `json:"allowfrom,omitempty" envSeparator:"|" env:"YAO_ALLOW_FROM"` // Domain list the separator is |
|
AllowFrom []string `json:"allowfrom,omitempty" envSeparator:"|" env:"YAO_ALLOW_FROM"` // Domain list the separator is |
|
||||||
Session SessionConfig `json:"session,omitempty"` // Session Config
|
Session Session `json:"session,omitempty"` // Session Config
|
||||||
Studio StudioConfig `json:"studio,omitempty"` // Studio config
|
Studio Studio `json:"studio,omitempty"` // Studio config
|
||||||
|
Runtime Runtime `json:"runtime,omitempty"` // Runtime config
|
||||||
}
|
}
|
||||||
|
|
||||||
// StudioConfig the studio config
|
// Studio the studio config
|
||||||
type StudioConfig struct {
|
type Studio struct {
|
||||||
Port int `json:"studio_port,omitempty" env:"YAO_STUDIO_PORT" envDefault:"5077"` // Studio port
|
Port int `json:"studio_port,omitempty" env:"YAO_STUDIO_PORT" envDefault:"5077"` // Studio port
|
||||||
Secret []byte `json:"studio_secret,omitempty" env:"YAO_STUDIO_SECRET"` // Studio Secret, if does not set, auto-generate a secret
|
Secret []byte `json:"studio_secret,omitempty" env:"YAO_STUDIO_SECRET"` // Studio Secret, if does not set, auto-generate a secret
|
||||||
Auto bool `json:"-"`
|
Auto bool `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DBConfig 数据库配置
|
// Database 数据库配置
|
||||||
type DBConfig struct {
|
type Database struct {
|
||||||
Driver string `json:"driver,omitempty" env:"YAO_DB_DRIVER" envDefault:"sqlite3"` // 数据库驱动 sqlite3| mysql| postgres
|
Driver string `json:"driver,omitempty" env:"YAO_DB_DRIVER" envDefault:"sqlite3"` // 数据库驱动 sqlite3| mysql| postgres
|
||||||
Primary []string `json:"primary,omitempty" env:"YAO_DB_PRIMARY" envSeparator:"|" envDefault:"./db/yao.db"` // 主库连接DSN
|
Primary []string `json:"primary,omitempty" env:"YAO_DB_PRIMARY" envSeparator:"|" envDefault:"./db/yao.db"` // 主库连接DSN
|
||||||
Secondary []string `json:"secondary,omitempty" env:"YAO_DB_SECONDARY" envSeparator:"|"` // 从库连接DSN
|
Secondary []string `json:"secondary,omitempty" env:"YAO_DB_SECONDARY" envSeparator:"|"` // 从库连接DSN
|
||||||
AESKey string `json:"aeskey,omitempty" env:"YAO_DB_AESKEY"` // 加密存储KEY
|
AESKey string `json:"aeskey,omitempty" env:"YAO_DB_AESKEY"` // 加密存储KEY
|
||||||
}
|
}
|
||||||
|
|
||||||
// SessionConfig 会话服务器
|
// Session 会话服务器
|
||||||
type SessionConfig struct {
|
type Session struct {
|
||||||
Store string `json:"store,omitempty" env:"YAO_SESSION_STORE" envDefault:"file"` // The session store. redis | file
|
Store string `json:"store,omitempty" env:"YAO_SESSION_STORE" envDefault:"file"` // The session store. redis | file
|
||||||
File string `json:"file,omitempty" env:"YAO_SESSION_FILE"` // The file path
|
File string `json:"file,omitempty" env:"YAO_SESSION_FILE"` // The file path
|
||||||
Host string `json:"host,omitempty" env:"YAO_SESSION_HOST" envDefault:"127.0.0.1"` // The redis host
|
Host string `json:"host,omitempty" env:"YAO_SESSION_HOST" envDefault:"127.0.0.1"` // The redis host
|
||||||
|
|
@ -47,3 +48,13 @@ type SessionConfig struct {
|
||||||
DB string `json:"db,omitempty" env:"YAO_SESSION_DB" envDefault:"1"` // The redis username
|
DB string `json:"db,omitempty" env:"YAO_SESSION_DB" envDefault:"1"` // The redis username
|
||||||
IsCLI bool `json:"iscli,omitempty" env:"YAO_SESSION_ISCLI" envDefault:"false"` // Command Line Start
|
IsCLI bool `json:"iscli,omitempty" env:"YAO_SESSION_ISCLI" envDefault:"false"` // Command Line Start
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Runtime Config
|
||||||
|
type Runtime struct {
|
||||||
|
MinSize int `json:"minSize,omitempty" env:"YAO_RUNTIME_MIN" envDefault:"2"` // the number of V8 VM when runtime start. max value is 100, the default value is 2
|
||||||
|
MaxSize int `json:"maxSize,omitempty" env:"YAO_RUNTIME_MAX" envDefault:"5"` // the maximum of V8 VM should be smaller than minSize, the default value is 10
|
||||||
|
HeapSizeLimit uint64 `json:"heapSizeLimit,omitempty" env:"YAO_RUNTIME_HEAP_LIMIT" envDefault:"1518338048"` // the isolate heap size limit should be smaller than 1.5G, and the default value is 1518338048 (1.5G)
|
||||||
|
HeapSizeRelease uint64 `json:"heapSizeRelease,omitempty" env:"YAO_RUNTIME_HEAP_RELEASE" envDefault:"52428800"` // the isolate will be re-created when reaching this value, and the default value is 52428800 (50M)
|
||||||
|
HeapAvailableSize uint64 `json:"heapAvailableSize,omitempty" env:"YAO_RUNTIME_HEAP_AVAILABLE" envDefault:"524288000"` // the isolate will be re-created when the available size is smaller than this value, and the default value is 524288000 (500M)
|
||||||
|
Precompile bool `json:"precompile,omitempty" env:"YAO_RUNTIME_PRECOMPILE" envDefault:"false"` // if true compile scripts when the VM is created. this will increase the load time, but the script will run faster. the default value is false
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,39 @@
|
||||||
package runtime
|
package runtime
|
||||||
|
|
||||||
// // Load runtime
|
import (
|
||||||
// func Load(cfg config.Config) error {
|
v8 "github.com/yaoapp/gou/runtime/v8"
|
||||||
// dataRoot, err := fs.Root(cfg)
|
"github.com/yaoapp/yao/config"
|
||||||
// if err != nil {
|
"github.com/yaoapp/yao/fs"
|
||||||
// return err
|
)
|
||||||
// }
|
|
||||||
// gou.LoadRuntime(runtime.Option{FileRoot: dataRoot})
|
// Start v8 runtime
|
||||||
// return nil
|
func Start(cfg config.Config) error {
|
||||||
// }
|
|
||||||
|
dataRoot, err := fs.Root(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
option := &v8.Option{
|
||||||
|
MinSize: cfg.Runtime.MinSize,
|
||||||
|
MaxSize: cfg.Runtime.MaxSize,
|
||||||
|
HeapSizeLimit: cfg.Runtime.HeapSizeLimit,
|
||||||
|
HeapAvailableSize: cfg.Runtime.HeapAvailableSize,
|
||||||
|
HeapSizeRelease: cfg.Runtime.HeapSizeRelease,
|
||||||
|
Precompile: cfg.Runtime.Precompile,
|
||||||
|
DataRoot: dataRoot,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = v8.Start(option)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stop v8 runtime
|
||||||
|
func Stop() error {
|
||||||
|
v8.Stop()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
||||||
15
runtime/runtime_test.go
Normal file
15
runtime/runtime_test.go
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package runtime
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/yaoapp/yao/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestStart(t *testing.T) {
|
||||||
|
defer Stop()
|
||||||
|
err := Start(config.Conf)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// DBConnect 建立数据库连接
|
// DBConnect 建立数据库连接
|
||||||
func DBConnect(dbconfig config.DBConfig) (err error) {
|
func DBConnect(dbconfig config.Database) (err error) {
|
||||||
|
|
||||||
if dbconfig.Primary == nil {
|
if dbconfig.Primary == nil {
|
||||||
return fmt.Errorf("YAO_DB_PRIMARY was not set")
|
return fmt.Errorf("YAO_DB_PRIMARY was not set")
|
||||||
|
|
|
||||||
10
test/test.go
10
test/test.go
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"github.com/yaoapp/kun/exception"
|
"github.com/yaoapp/kun/exception"
|
||||||
"github.com/yaoapp/xun/capsule"
|
"github.com/yaoapp/xun/capsule"
|
||||||
"github.com/yaoapp/yao/config"
|
"github.com/yaoapp/yao/config"
|
||||||
|
"github.com/yaoapp/yao/runtime"
|
||||||
"github.com/yaoapp/yao/share"
|
"github.com/yaoapp/yao/share"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -39,11 +40,13 @@ func Prepare(t *testing.T, cfg config.Config) {
|
||||||
|
|
||||||
dbconnect(t, cfg)
|
dbconnect(t, cfg)
|
||||||
load(t, cfg)
|
load(t, cfg)
|
||||||
|
start(t, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean the test environment
|
// Clean the test environment
|
||||||
func Clean() {
|
func Clean() {
|
||||||
dbclose()
|
dbclose()
|
||||||
|
runtime.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
func dbclose() {
|
func dbclose() {
|
||||||
|
|
@ -71,6 +74,13 @@ func dbconnect(t *testing.T, cfg config.Config) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func start(t *testing.T, cfg config.Config) {
|
||||||
|
err := runtime.Start(cfg)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func load(t *testing.T, cfg config.Config) {
|
func load(t *testing.T, cfg config.Config) {
|
||||||
loadModel(t, cfg)
|
loadModel(t, cfg)
|
||||||
loadQuery(t, cfg)
|
loadQuery(t, cfg)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue