diff --git a/common/structs/check.go b/common/structs/check.go index cbcb61e91..fce0b208b 100644 --- a/common/structs/check.go +++ b/common/structs/check.go @@ -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 { diff --git a/docs/docs.go b/docs/docs.go index 082252f1e..fa593e862 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -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": { @@ -9549,7 +9567,7 @@ var doc = `{ "delay": { "type": "object", "additionalProperties": { - "type": "integer" + "$ref": "#/definitions/structs.CheckRangeInt32" } }, "hosts": { @@ -9561,7 +9579,7 @@ var doc = `{ "ntp": { "type": "object", "additionalProperties": { - "type": "integer" + "$ref": "#/definitions/structs.CheckRangeInt32" } }, "ping": { diff --git a/docs/swagger.json b/docs/swagger.json index 91a6db4bc..dc80eb815 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -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": { @@ -9535,7 +9553,7 @@ "delay": { "type": "object", "additionalProperties": { - "type": "integer" + "$ref": "#/definitions/structs.CheckRangeInt32" } }, "hosts": { @@ -9547,7 +9565,7 @@ "ntp": { "type": "object", "additionalProperties": { - "type": "integer" + "$ref": "#/definitions/structs.CheckRangeInt32" } }, "ping": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 80394ba7f..4b5d8e737 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -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: @@ -2256,7 +2268,7 @@ definitions: properties: delay: additionalProperties: - type: integer + $ref: '#/definitions/structs.CheckRangeInt32' type: object hosts: additionalProperties: @@ -2264,7 +2276,7 @@ definitions: type: object ntp: additionalProperties: - type: integer + $ref: '#/definitions/structs.CheckRangeInt32' type: object ping: additionalProperties: diff --git a/micro-cluster/cluster/log/executor.go b/micro-cluster/cluster/log/executor.go index 122544866..e58783a0f 100644 --- a/micro-cluster/cluster/log/executor.go +++ b/micro-cluster/cluster/log/executor.go @@ -28,6 +28,7 @@ import ( "encoding/json" "fmt" + "github.com/pingcap-inc/tiem/deployment" "github.com/pingcap-inc/tiem/common/structs" @@ -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