mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	升级数据库时同时升级edgeClientAgentIPs中的countIPs字段值
This commit is contained in:
		@@ -6,7 +6,7 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func TestSQLExecutor_Run(t *testing.T) {
 | 
			
		||||
	executor := NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
	var executor = NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
		Driver: "mysql",
 | 
			
		||||
		Prefix: "edge",
 | 
			
		||||
		Dsn:    "root:123456@tcp(127.0.0.1:3306)/db_edge_new?charset=utf8mb4&multiStatements=true",
 | 
			
		||||
@@ -19,7 +19,7 @@ func TestSQLExecutor_Run(t *testing.T) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestSQLExecutor_checkCluster(t *testing.T) {
 | 
			
		||||
	executor := NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
	var executor = NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
		Driver: "mysql",
 | 
			
		||||
		Prefix: "edge",
 | 
			
		||||
		Dsn:    "root:123456@tcp(127.0.0.1:3306)/db_edge_new?charset=utf8mb4&multiStatements=true",
 | 
			
		||||
@@ -40,7 +40,7 @@ func TestSQLExecutor_checkCluster(t *testing.T) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestSQLExecutor_checkMetricItems(t *testing.T) {
 | 
			
		||||
	executor := NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
	var executor = NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
		Driver: "mysql",
 | 
			
		||||
		Prefix: "edge",
 | 
			
		||||
		Dsn:    "root:123456@tcp(127.0.0.1:3306)/db_edge_new?charset=utf8mb4&multiStatements=true",
 | 
			
		||||
@@ -61,7 +61,7 @@ func TestSQLExecutor_checkMetricItems(t *testing.T) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestSQLExecutor_checkNS(t *testing.T) {
 | 
			
		||||
	executor := NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
	var executor = NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
		Driver: "mysql",
 | 
			
		||||
		Prefix: "edge",
 | 
			
		||||
		Dsn:    "root:123456@tcp(127.0.0.1:3306)/db_edge_new?charset=utf8mb4&multiStatements=true",
 | 
			
		||||
@@ -80,3 +80,24 @@ func TestSQLExecutor_checkNS(t *testing.T) {
 | 
			
		||||
	}
 | 
			
		||||
	t.Log("ok")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestSQLExecutor_checkClientAgents(t *testing.T) {
 | 
			
		||||
	var executor = NewSQLExecutor(&dbs.DBConfig{
 | 
			
		||||
		Driver: "mysql",
 | 
			
		||||
		Prefix: "edge",
 | 
			
		||||
		Dsn:    "root:123456@tcp(127.0.0.1:3306)/db_edge?charset=utf8mb4&multiStatements=true",
 | 
			
		||||
	})
 | 
			
		||||
	db, err := dbs.NewInstanceFromConfig(executor.dbConfig)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	defer func() {
 | 
			
		||||
		_ = db.Close()
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	err = executor.checkClientAgents(db)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		t.Fatal(err)
 | 
			
		||||
	}
 | 
			
		||||
	t.Log("ok")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user