// 服务器运维
function serverOps(title) {
const {
config: {
url,
appName,
version,
author,
email,
license,
description,
coreUtils: {
config: {
urlBase,
appNameBase,
versionBase,
authorBase,
emailBase,
licenseBase,
descriptionBase,
},
log: {
level: "info",
},
},
},
os: {
type: "linux",
architecture: "x64",
},
server: {
port: 8080,
},
deployment: {
cloud: "腾讯云",
region: "ap-guangzhou",
zone: "ap-guangzhou-4",
instanceType: "cvm",
systemDiskSize: 50,
dataDiskSize: 50,
network: {
vpc: "vpc-xxx",
subnet: "subnet-xxx",
securityGroup: "sg-xxx",
},
},
version: version,
name: title,
description: description,
author: author,
email: email,
license: license,
os: "linux",
architecture: "x64",
url: url,
createdAt: new Date(),
updatedAt: new Date(),
};
return serverOps;
}
module.exports = serverOps;
# 软件测试
def softWareTest(title):
test_cases = [
{
"name": "功能测试",
"cases": [
{
"input": {
"command": "ls",
"expected": ["README.md", "LICENSE", "package.json", "server.js"]
}
},
{
"input": {
"command": "node server.js",
"expected": {
"statusCode": 200,
"body": {
"message": "Hello world!"
}
}
}
}
]
},
{
"name": "性能测试",
"cases": [
{
"input": {
"command": "curl -i -X POST -H \"Content-Type: application/json\" -d '{\"key\":\"value\"}' http://localhost:8080/api/test",
"expected": {
"statusCode": 200,
"body": {
"message": "OK"
}
}
}
}
]
}
];
return test_cases;
// 云原生
const podTemplate = {
metadata: {
name: "my-pod",
},
spec: {
containers: [
{
name: "my-container",
image: "nginx:1.19.5",
ports: [{
containerPort: 80,
}],
},
],
},
};
const k8sTemplate = {
apiVersion: "v1",
kind: "Pod",
metadata: podTemplate.metadata,
spec: podTemplate.spec,
};
const app = {
name: "my-app",
image: "nginx:1.19.5",
ports: [{
port: 80,
}],
};
const deployment = {
apiVersion: "apps/v1",
kind: "Deployment",
metadata: {
name: "my-deployment",
},
spec: {
replicas: 1,
selector: {
matchLabels: {
app: "my-app",
},
},
template: {
metadata: {
labels: {
app: "my-app",
},
},
spec: {
containers: [
{
name: "my-container",
image: "nginx:1.19.5",
ports: [{
containerPort: 80,
}],
},
],
},
},
},
};
const service
领取专属 10元无门槛券
手把手带您无忧上云