mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
[CI]Chaostest suite initiation (#5793)
* Initiate chaostest cli test suite: singlenodeheight on one dev node
Added chaostest stages in CI
Added new docker/k8s resources and environments to CI
Added new chaos-only tag to gitlab-ci.yml
* Update .maintain/chaostest/src/commands/singlenodeheight/index.js
Co-authored-by: Max Inden <mail@max-inden.de>
* change nameSpace to namespace(one word)
* update chaos ci job to match template
* rename build-pr ci stage to docker [chaos:basic]
* test gitlab-ci [chaos:basic]
* Update .gitlab-ci.yml
* add new build-chaos-only condition
* add *default-vars to singlenodeheight [chaos:basic]
* change build-only to build-rules on substrate jobs [chaos:basic]
* test and change when:on_success to when:always [chaos:basic]
* resolve conflicts and test [chaos:basic]
Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
chaostest CONFIG
|
||||
=========
|
||||
|
||||
Since deployment can behave differently, we want to keep a state between phases including different test subjects.
|
||||
|
||||
# Content
|
||||
The state could include informations such as:
|
||||
```
|
||||
{
|
||||
namespace,
|
||||
image,
|
||||
bootnode: {
|
||||
podname,
|
||||
ip,
|
||||
port,
|
||||
peerId,
|
||||
privateKey,
|
||||
publicKey
|
||||
},
|
||||
nodes: [{
|
||||
podname,
|
||||
ip,
|
||||
port,
|
||||
nodeType: 'validator' | 'bootnode' | ,
|
||||
privateKey (validator only),
|
||||
publicKey (validator only)
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
# TODO
|
||||
k8s configuration
|
||||
chainspec
|
||||
chaos-agent
|
||||
@@ -0,0 +1,70 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const configPath = path.join(__dirname, './config.json')
|
||||
const logger = require('../utils/logger')
|
||||
|
||||
class Config {
|
||||
constructor () {
|
||||
this.load()
|
||||
}
|
||||
|
||||
async load () {
|
||||
fs.readFile(configPath, (err, data) => {
|
||||
if (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
this.reset()
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Object.assign(this, JSON.parse(data))
|
||||
} catch (error) {
|
||||
logger.error('config file is corrupted, resetting...')
|
||||
this.reset()
|
||||
}
|
||||
};
|
||||
})
|
||||
};
|
||||
|
||||
getConfig () {
|
||||
return this
|
||||
}
|
||||
|
||||
async update () {
|
||||
const data = JSON.stringify(this.getConfig())
|
||||
fs.writeFile(configPath, data, (err) => {
|
||||
if (err) throw err
|
||||
logger.debug('Configuration updated')
|
||||
})
|
||||
}
|
||||
|
||||
async setNamespace (namespace) {
|
||||
this.namespace = namespace
|
||||
this.update()
|
||||
}
|
||||
|
||||
async addNode (node) {
|
||||
if (!this.nodes || Array.isArray(this.nodes)) {
|
||||
this.nodes = []
|
||||
}
|
||||
if (node.nodeType === 'bootnode') {
|
||||
this.bootnode = node
|
||||
}
|
||||
this.nodes.push(node)
|
||||
this.update()
|
||||
}
|
||||
|
||||
async reset () {
|
||||
const data = JSON.stringify({})
|
||||
fs.writeFile(configPath, data, (err) => {
|
||||
if (err) throw err
|
||||
this.load()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = () => {
|
||||
const config = new Config()
|
||||
return config
|
||||
}
|
||||
Reference in New Issue
Block a user