feat(test): adding tests for the "File" struct
feat(test): moving util funcs into utils module
This commit is contained in:
66
data/config/go-test-conf.json
Normal file
66
data/config/go-test-conf.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"ConfigFiles": [
|
||||
{
|
||||
"destination": "/etc/loki/loki-local-config.yaml",
|
||||
"group": "grafana",
|
||||
"mode": "600",
|
||||
"owner": "loki",
|
||||
"service": "loki",
|
||||
"source": "loki-local-config.pktpl.hcl"
|
||||
}
|
||||
],
|
||||
"Daemons": {
|
||||
"Loki": {
|
||||
"enabled": true,
|
||||
"name": "loki"
|
||||
}
|
||||
},
|
||||
"Packages": {
|
||||
"loki": {
|
||||
"action": "install",
|
||||
"name": "loki"
|
||||
},
|
||||
"nodeExporter": {
|
||||
"action": "install",
|
||||
"name": "prometheus-node-exporter"
|
||||
},
|
||||
"promtail": {
|
||||
"action": "install",
|
||||
"name": "loki-promtail"
|
||||
}
|
||||
},
|
||||
"Repositories": {
|
||||
"AlpineTesting": {
|
||||
"enabled": true,
|
||||
"name": "testing",
|
||||
"type": "apk",
|
||||
"url": "http://mirrors.bfsu.edu.cn/alpine/edge/testing"
|
||||
}
|
||||
},
|
||||
"Users": {
|
||||
"loki": {
|
||||
"group": "grafana",
|
||||
"home": "/srv/loki",
|
||||
"shell": "/bin/nologin",
|
||||
"username": "loki"
|
||||
}
|
||||
},
|
||||
"Vars": {
|
||||
"AlertManagerURL": "http://localhost:9092",
|
||||
"AuthEnabled": false,
|
||||
"GRPCPort": "9095",
|
||||
"Group": "grafana",
|
||||
"HTTPPort": "3099",
|
||||
"LogLevel": "error",
|
||||
"ObjectStore": "filesystem",
|
||||
"S2": {
|
||||
"APIKey": "",
|
||||
"APISecretKey": "",
|
||||
"BucketName": "",
|
||||
"URL": ""
|
||||
},
|
||||
"SharedStore": "filesystem",
|
||||
"StorageRoot": "/var/loki",
|
||||
"User": "loki"
|
||||
}
|
||||
}
|
13
data/templates/go-test-go.tpl
Normal file
13
data/templates/go-test-go.tpl
Normal file
@ -0,0 +1,13 @@
|
||||
### Go template test ###
|
||||
{{ if .Vars.AuthEnabled }}
|
||||
auth_enabled: true
|
||||
{{ else }}
|
||||
auth_enabled: false
|
||||
{{ end }}
|
||||
|
||||
server:
|
||||
http_listen_port: {{ .Vars.HTTPPort }}
|
||||
grpc_listen_port: {{ .Vars.GRPCPort }}
|
||||
log_level: {{ .Vars.LogLevel }}
|
||||
|
||||
### End Go template test ###
|
12
data/templates/go-test-hcl.pktpl.hcl
Normal file
12
data/templates/go-test-hcl.pktpl.hcl
Normal file
@ -0,0 +1,12 @@
|
||||
### HCL2 Template test ###
|
||||
%{ if Vars.AuthEnabled ~}
|
||||
auth_enabled: true
|
||||
%{ else }
|
||||
auth_enabled: false
|
||||
%{ endif }
|
||||
|
||||
server:
|
||||
http_listen_port: ${Vars.HTTPPort}
|
||||
grpc_listen_port: ${Vars.GRPCPort}
|
||||
log_level: ${Vars.LogLevel}
|
||||
### END HCL Template test ###
|
@ -1,13 +1,13 @@
|
||||
{{ if .AuthEnabled }}
|
||||
{{ if .Vars.AuthEnabled }}
|
||||
auth_enabled: true
|
||||
{{ else }}
|
||||
auth_enabled: false
|
||||
{{ end }}
|
||||
|
||||
server:
|
||||
http_listen_port: {{ .HTTPPort }}
|
||||
grpc_listen_port: {{ .GRPCPort }}
|
||||
log_level: {{ .LogLevel }}
|
||||
http_listen_port: {{ .Vars.HTTPPort }}
|
||||
grpc_listen_port: {{ .Vars.GRPCPort }}
|
||||
log_level: {{ .Vars.LogLevel }}
|
||||
|
||||
ingester:
|
||||
wal:
|
||||
|
Reference in New Issue
Block a user