Skip to content

Commit

Permalink
Merge pull request #618 from YaozhengWang/feature/check
Browse files Browse the repository at this point in the history
Feature/check
  • Loading branch information
YaozhengWang committed Feb 14, 2022
2 parents 7a04857 + 7c70db4 commit d4144c3
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 12 deletions.
16 changes: 11 additions & 5 deletions common/structs/check.go
Expand Up @@ -81,12 +81,18 @@ type InstanceCheck struct {
type CheckKey struct {
Source, Target string
}

type CheckRangeInt32 struct {
Valid bool `json:"valid"`
RealValue int32 `json:"realValue"`
ExpectedRange []int32 `json:"expectedRange"` // Left closed right closed interval
}
type HostsCheck struct {
NTP map[CheckKey]int32 `json:"ntp"`
TimeZoneConsistency map[CheckKey]bool `json:"timeZoneConsistency"`
Ping map[CheckKey]bool `json:"ping"`
Delay map[CheckKey]int32 `json:"delay"`
Hosts map[string]HostCheck `json:"hosts"`
NTP map[CheckKey]CheckRangeInt32 `json:"ntp"`
TimeZoneConsistency map[CheckKey]bool `json:"timeZoneConsistency"`
Ping map[CheckKey]bool `json:"ping"`
Delay map[CheckKey]CheckRangeInt32 `json:"delay"`
Hosts map[string]HostCheck `json:"hosts"`
}

type CheckSwitch struct {
Expand Down
22 changes: 20 additions & 2 deletions docs/docs.go
Expand Up @@ -8758,6 +8758,24 @@ var doc = `{
}
}
},
"structs.CheckRangeInt32": {
"type": "object",
"properties": {
"expectedRange": {
"description": "Left closed right closed interval",
"type": "array",
"items": {
"type": "integer"
}
},
"realValue": {
"type": "integer"
},
"valid": {
"type": "boolean"
}
}
},
"structs.CheckStatus": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -9549,7 +9567,7 @@ var doc = `{
"delay": {
"type": "object",
"additionalProperties": {
"type": "integer"
"$ref": "#/definitions/structs.CheckRangeInt32"
}
},
"hosts": {
Expand All @@ -9561,7 +9579,7 @@ var doc = `{
"ntp": {
"type": "object",
"additionalProperties": {
"type": "integer"
"$ref": "#/definitions/structs.CheckRangeInt32"
}
},
"ping": {
Expand Down
22 changes: 20 additions & 2 deletions docs/swagger.json
Expand Up @@ -8744,6 +8744,24 @@
}
}
},
"structs.CheckRangeInt32": {
"type": "object",
"properties": {
"expectedRange": {
"description": "Left closed right closed interval",
"type": "array",
"items": {
"type": "integer"
}
},
"realValue": {
"type": "integer"
},
"valid": {
"type": "boolean"
}
}
},
"structs.CheckStatus": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -9535,7 +9553,7 @@
"delay": {
"type": "object",
"additionalProperties": {
"type": "integer"
"$ref": "#/definitions/structs.CheckRangeInt32"
}
},
"hosts": {
Expand All @@ -9547,7 +9565,7 @@
"ntp": {
"type": "object",
"additionalProperties": {
"type": "integer"
"$ref": "#/definitions/structs.CheckRangeInt32"
}
},
"ping": {
Expand Down
16 changes: 14 additions & 2 deletions docs/swagger.yaml
Expand Up @@ -1706,6 +1706,18 @@ definitions:
valid:
type: boolean
type: object
structs.CheckRangeInt32:
properties:
expectedRange:
description: Left closed right closed interval
items:
type: integer
type: array
realValue:
type: integer
valid:
type: boolean
type: object
structs.CheckStatus:
properties:
health:
Expand Down Expand Up @@ -2256,15 +2268,15 @@ definitions:
properties:
delay:
additionalProperties:
type: integer
$ref: '#/definitions/structs.CheckRangeInt32'
type: object
hosts:
additionalProperties:
$ref: '#/definitions/structs.HostCheck'
type: object
ntp:
additionalProperties:
type: integer
$ref: '#/definitions/structs.CheckRangeInt32'
type: object
ping:
additionalProperties:
Expand Down
3 changes: 2 additions & 1 deletion micro-cluster/cluster/log/executor.go
Expand Up @@ -28,6 +28,7 @@ import (
"encoding/json"

"fmt"

"github.com/pingcap-inc/tiem/deployment"

"github.com/pingcap-inc/tiem/common/structs"
Expand Down Expand Up @@ -121,7 +122,7 @@ func getDeployInfo(clusterMeta *meta.ClusterMeta, ctx *workflow.FlowContext, hos
clusterName = framework.Current.GetClientArgs().EMClusterName

// Parse EM topology structure to get filebeat deploy dir
result, err := deployment.M.Display(ctx, clusterComponentType, clusterName, "/home/tiem/.tiuptiem", []string{"--format", "json"}, 0)
result, err := deployment.M.Display(ctx, clusterComponentType, clusterName, "/home/tiem/.tiuptiem", []string{"--json"}, 0)
if err != nil {
framework.LogWithContext(ctx).Errorf("invoke tiup cluster display err: %v", err)
return "", "", "", err
Expand Down

0 comments on commit d4144c3

Please sign in to comment.