mirror of
				https://github.com/ClusterCockpit/cc-backend
				synced 2025-11-04 09:35:07 +01:00 
			
		
		
		
	Fix api testcase
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -9,3 +9,4 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/web/frontend/public/build
 | 
					/web/frontend/public/build
 | 
				
			||||||
/web/frontend/node_modules
 | 
					/web/frontend/node_modules
 | 
				
			||||||
 | 
					.vscode/settings.json
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -140,7 +140,8 @@
 | 
				
			|||||||
                                "enum": [
 | 
					                                "enum": [
 | 
				
			||||||
                                    "influxdb-v2",
 | 
					                                    "influxdb-v2",
 | 
				
			||||||
                                    "prometheus",
 | 
					                                    "prometheus",
 | 
				
			||||||
                                    "cc-metric-store"
 | 
					                                    "cc-metric-store",
 | 
				
			||||||
 | 
					                                    "test"
 | 
				
			||||||
                                ]
 | 
					                                ]
 | 
				
			||||||
                            },
 | 
					                            },
 | 
				
			||||||
                            "url": {
 | 
					                            "url": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,12 +38,17 @@ func setup(t *testing.T) *api.RestApi {
 | 
				
			|||||||
	"clusters": [
 | 
						"clusters": [
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
	   "name": "testcluster",
 | 
						   "name": "testcluster",
 | 
				
			||||||
	   "metricDataRepository": {"kind": "test"}
 | 
						   "metricDataRepository": {"kind": "test", "url": "bla:8081"},
 | 
				
			||||||
 | 
						   "filterRanges": {
 | 
				
			||||||
 | 
							"numNodes": { "from": 1, "to": 64 },
 | 
				
			||||||
 | 
							"duration": { "from": 0, "to": 86400 },
 | 
				
			||||||
 | 
							"startTime": { "from": "2022-01-01T00:00:00Z", "to": null }
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	]
 | 
						]
 | 
				
			||||||
}`
 | 
					}`
 | 
				
			||||||
	const testclusterJson = `{
 | 
						const testclusterJson = `{
 | 
				
			||||||
"name": "testcluster",
 | 
					        "name": "testcluster",
 | 
				
			||||||
		"subClusters": [
 | 
							"subClusters": [
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				"name": "sc0",
 | 
									"name": "sc0",
 | 
				
			||||||
@@ -64,12 +69,10 @@ func setup(t *testing.T) *api.RestApi {
 | 
				
			|||||||
					"socket": [[0, 1, 2, 3, 4, 5, 6, 7]],
 | 
										"socket": [[0, 1, 2, 3, 4, 5, 6, 7]],
 | 
				
			||||||
					"memoryDomain": [[0, 1, 2, 3, 4, 5, 6, 7]],
 | 
										"memoryDomain": [[0, 1, 2, 3, 4, 5, 6, 7]],
 | 
				
			||||||
					"die": [[0, 1, 2, 3, 4, 5, 6, 7]],
 | 
										"die": [[0, 1, 2, 3, 4, 5, 6, 7]],
 | 
				
			||||||
					"core": [[0], [1], [2], [3], [4], [5], [6], [7]],
 | 
										"core": [[0], [1], [2], [3], [4], [5], [6], [7]]
 | 
				
			||||||
					"accelerators": []
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		],
 | 
							],
 | 
				
			||||||
		"metricDataRepository": {"kind": "test"},
 | 
					 | 
				
			||||||
		"metricConfig": [
 | 
							"metricConfig": [
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				"name": "load_one",
 | 
									"name": "load_one",
 | 
				
			||||||
@@ -81,7 +84,7 @@ func setup(t *testing.T) *api.RestApi {
 | 
				
			|||||||
				"caution": 0,
 | 
									"caution": 0,
 | 
				
			||||||
				"alert": 0
 | 
									"alert": 0
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		],
 | 
							]
 | 
				
			||||||
	}`
 | 
						}`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tmpdir := t.TempDir()
 | 
						tmpdir := t.TempDir()
 | 
				
			||||||
@@ -111,7 +114,7 @@ func setup(t *testing.T) *api.RestApi {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	config.Init(cfgFilePath)
 | 
						config.Init(cfgFilePath)
 | 
				
			||||||
	archiveCfg := fmt.Sprintf("{\"kind\":\"file\",\"path\":\"%s\"}", jobarchive)
 | 
						archiveCfg := fmt.Sprintf("{\"kind\": \"file\",\"path\": \"%s\"}", jobarchive)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	repository.Connect("sqlite3", dbfilepath)
 | 
						repository.Connect("sqlite3", dbfilepath)
 | 
				
			||||||
	db := repository.GetConnection()
 | 
						db := repository.GetConnection()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user