Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM node:20-alpine3.17 AS ui
FROM docker.io/library/node:20-alpine3.17 AS ui

WORKDIR /workspace
COPY console/atest-ui .
RUN npm install --ignore-scripts --registry=https://registry.npmmirror.com
RUN npm run build-only

FROM apache/skywalking-go:0.2.0-go1.18 AS sk
FROM docker.io/apache/skywalking-go:0.2.0-go1.18 AS sk

FROM golang:1.19 AS builder
FROM docker.io/golang:1.19 AS builder

ARG VERSION
ARG GOPROXY
Expand Down Expand Up @@ -42,7 +42,7 @@ RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-or
RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-s3 extensions/store-s3/main.go
RUN GOPROXY=${GOPROXY} CGO_ENABLED=0 go build -ldflags "-w -s" -o atest-store-git extensions/store-git/main.go

FROM ubuntu:23.04
FROM docker.io/library/ubuntu:23.04

LABEL "com.github.actions.name"="API testing"
LABEL "com.github.actions.description"="API testing"
Expand All @@ -63,11 +63,10 @@ COPY --from=builder /workspace/atest-store-git /usr/local/bin/atest-store-git
COPY --from=builder /workspace/LICENSE /LICENSE
COPY --from=builder /workspace/README.md /README.md

RUN mkdir -p /var/www/data
COPY --from=builder /workspace/sample /var/www/sample

RUN apt update -y && \
# required for atest-store-git
apt install -y --no-install-recommends ssh-client ca-certificates

CMD ["atest", "server", "--local-storage=/var/www/sample/*.yaml", "--local-storage=/var/www/data/*.yaml"]
CMD ["atest", "server", "--local-storage=/var/www/sample/*.yaml"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ IMG_TOOL?=podman
BINARY?=atest
TOOLEXEC?=-toolexec="skywalking-go-agent"
GOPROXY?=https://goproxy.cn,direct
HELM_VERSION?=v0.0.1
HELM_VERSION?=v0.0.2
APP_VERSION?=v0.0.13

build:
Expand Down
12 changes: 8 additions & 4 deletions console/atest-ui/src/views/TestSuite.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ function save() {
fetch('/server.Runner/UpdateTestSuite', requestOptions)
.then((response) => response.json())
.then((e) => {
ElMessage({
message: 'Updated.',
type: 'success'
})
if (e.error === "") {
ElMessage({
message: 'Updated.',
type: 'success'
})
} else {
ElMessage.error('Oops, ' + e.message)
}
})
.catch((e) => {
ElMessage.error('Oops, ' + e)
Expand Down
2 changes: 1 addition & 1 deletion helm/api-testing/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v0.0.1
version: v0.0.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
21 changes: 21 additions & 0 deletions helm/api-testing/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $core := .Values.persistence.persistentVolumeClaim.core -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -45,6 +46,13 @@ spec:
httpGet:
path: /
port: http
volumeMounts:
- name: data
mountPath: /var/www/sample
subPath: {{ $core.subPath }}
- name: data
mountPath: /root
subPath: config
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand All @@ -59,3 +67,16 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if not .Values.persistence.enabled }}
- name: "data"
emptyDir: {}
{{- else if $core.existingClaim }}
- name: "data"
persistentVolumeClaim:
claimName: {{ $core.existingClaim }}
{{- else }}
- name: "data"
persistentVolumeClaim:
claimName: {{ include "api-testing.fullname" . }}
{{- end -}}
22 changes: 22 additions & 0 deletions helm/api-testing/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- $core := .Values.persistence.persistentVolumeClaim.core -}}
{{- if and .Values.persistence.enabled (not $core.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "api-testing.fullname" . }}
labels:
{{- include "api-testing.labels" . | nindent 4 }}
spec:
accessModes:
- {{ $core.accessMode }}
resources:
requests:
storage: {{ $core.size }}
{{- if $core.storageClass }}
{{- if eq "-" $core.storageClass }}
storageClassName: ""
{{- else }}
storageClassName: {{ $core.storageClass }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions helm/api-testing/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ spec:
targetPort: http
protocol: TCP
name: http
{{- if and .Values.service.nodePort }}
nodePort: {{ .Values.service.nodePort }}
{{- end}}
selector:
{{- include "api-testing.selectorLabels" . | nindent 4 }}
11 changes: 11 additions & 0 deletions helm/api-testing/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ securityContext: {}
service:
type: ClusterIP
port: 8080
nodePort: ""

ingress:
enabled: false
Expand Down Expand Up @@ -75,6 +76,16 @@ autoscaling:
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

persistence:
enabled: true
persistentVolumeClaim:
core:
existingClaim: ""
storageClass: ""
subPath: ""
accessMode: ReadWriteMany
size: 500Mi

nodeSelector: {}

tolerations: []
Expand Down
5 changes: 3 additions & 2 deletions pkg/server/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ func ToGRPCStore(store testing.Store) (result *Store) {
result = &Store{
Name: store.Name,
Kind: &StoreKind{
Name: store.Kind.Name,
Url: store.Kind.URL,
Name: store.Kind.Name,
Url: store.Kind.URL,
Enabled: store.Kind.Enabled,
},
Description: store.Description,
Url: store.URL,
Expand Down
21 changes: 20 additions & 1 deletion pkg/testing/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,26 @@ func (s *storeFactory) CreateStore(store Store) (err error) {
}

func (s *storeFactory) save(storeConfig *StoreConfig) (err error) {
if err = os.MkdirAll(s.configDir, 0755);err==nil{
for i, item := range storeConfig.Stores {
if item.Kind.Name != "" {
storeConfig.Stores[i].Kind.Enabled = true

foundPlugin := false
for j, kind := range storeConfig.Plugins {
if kind.Name == item.Kind.Name {
foundPlugin = true
storeConfig.Plugins[j].Enabled = true
break
}
}

if !foundPlugin {
storeConfig.Plugins = append(storeConfig.Plugins, storeConfig.Stores[i].Kind)
}
}
}

if err = os.MkdirAll(s.configDir, 0755); err == nil {
var data []byte
if data, err = yaml.Marshal(storeConfig); err == nil {
err = os.WriteFile(path.Join(s.configDir, "stores.yaml"), data, 0644)
Expand Down
5 changes: 3 additions & 2 deletions pkg/testing/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func TestStoreFactory(t *testing.T) {
assert.Equal(t, &Store{
Name: "db",
Kind: StoreKind{
Name: "database",
URL: "localhost:7071",
Name: "database",
URL: "localhost:7071",
Enabled: true,
},
URL: "localhost:4000",
Username: "root",
Expand Down
7 changes: 5 additions & 2 deletions pkg/testing/testdata/stores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ stores:
kind:
name: database
url: localhost:7071
enabled: false
enabled: true
description: ""
url: localhost:4000
username: root
password: ""
properties:
database: test
plugins: []
plugins:
- name: database
url: localhost:7071
enabled: true