Skip to content

Commit 53c346d

Browse files
authored
Revert github.com/prometheus/client_golang to v1.20.5 (#4795)
* Downgrade github.com/prometheus/client_golang to v1.20.5 Signed-off-by: trafalgarzzz <[email protected]> * go fmt Signed-off-by: trafalgarzzz <[email protected]> * Upgrade go.mod to 1.23.7 Signed-off-by: trafalgarzzz <[email protected]> --------- Signed-off-by: trafalgarzzz <[email protected]>
1 parent 409ec84 commit 53c346d

37 files changed

+227
-823
lines changed

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module github.com/fluid-cloudnative/fluid
22

3-
go 1.22.10
4-
toolchain go1.23.7
3+
go 1.23.7
54

65
replace k8s.io/api => k8s.io/api v0.29.5
76

@@ -69,7 +68,7 @@ require (
6968
github.com/onsi/ginkgo v1.16.5
7069
github.com/onsi/gomega v1.36.2
7170
github.com/pkg/errors v0.9.1
72-
github.com/prometheus/client_golang v1.21.0
71+
github.com/prometheus/client_golang v1.20.5
7372
github.com/smartystreets/goconvey v1.8.1
7473
github.com/spf13/cobra v1.9.1
7574
github.com/stretchr/testify v1.10.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrb
12271227
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
12281228
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
12291229
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
1230-
github.com/prometheus/client_golang v1.21.0 h1:DIsaGmiaBkSangBgMtWdNfxbMNdku5IK6iNhrEqWvdA=
1231-
github.com/prometheus/client_golang v1.21.0/go.mod h1:U9NM32ykUErtVBxdvD3zfi+EuFkkaBvMb09mIfe0Zgg=
1230+
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
1231+
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
12321232
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
12331233
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
12341234
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=

pkg/ddc/alluxio/cache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ func (e *AlluxioEngine) queryCacheStatus() (states cacheStates, err error) {
6868
// - When the Dataset's UfsTotal field is empty
6969
// - When the Dataset's UfsTotal field contains the metadata sync pending message
7070
// The cached percentage is calculated as (cached bytes / UfsTotal bytes) * 100.
71-
//
71+
//
7272
// Parameters:
7373
// - dataset (v1alpha1.Dataset): Pointer to the Dataset object containing UFS metadata.
7474
// The Status.UfsTotal field must be a valid human-readable size string (e.g. "10GiB")
7575
// - states (cacheStates): Pointer to the cache state structure that will be modified in-place.
7676
// The cached field must be a valid human-readable size string (e.g. "5GiB")
77-
//
77+
//
7878
// Returns:
7979
// - None: Modifies the states.cachedPercentage field directly with formatted percentage string.
8080
// The percentage is stored as a string using cachedPercentageFormat (e.g. "45.60%")

pkg/ddc/alluxio/load_data.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ func (e *AlluxioEngine) genDataLoadValue(image string, targetDataset *datav1alph
175175
// It obtains master pod details, creates file utilities, and checks readiness.
176176
//
177177
// Returns:
178-
// ready bool - Runtime readiness status (true = ready, false = not ready).
178+
//
179+
// ready bool - Runtime readiness status (true = ready, false = not ready).
179180
func (e *AlluxioEngine) CheckRuntimeReady() (ready bool) {
180181
podName, containerName := e.getMasterPodInfo()
181182
fileUtils := operations.NewAlluxioFileUtils(podName, containerName, e.namespace, e.Log)

pkg/ddc/alluxio/master_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ func TestCheckMasterReady(t *testing.T) {
166166

167167
// TestShouldSetupMaster tests the ShouldSetupMaster function of AlluxioEngine.
168168
// Functionality: Verifies if the Alluxio master should be set up based on runtime status.
169-
// Parameters:
169+
// Parameters:
170170
// - t *testing.T: Standard testing object for test reporting and logging.
171+
//
171172
// Return: None (testing function).
172173
// Notes:
173174
// - Uses fake client to simulate interactions with Kubernetes API.

pkg/ddc/alluxio/transform_resources.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ func (e *AlluxioEngine) transformResourcesForMaster(runtime *datav1alpha1.Alluxi
4848
}
4949

5050
// transformResourcesForWorker is responsible for transforming and setting resource limits for the Alluxio Worker component.
51-
// This function updates the resource requirements for the Worker and JobWorker based on the runtime configuration
51+
// This function updates the resource requirements for the Worker and JobWorker based on the runtime configuration
5252
// and ensures that memory requests meet the required constraints.
5353
//
5454
// Parameters:
55-
// - runtime: *datav1alpha1.AlluxioRuntime, the runtime configuration of Alluxio, including resource definitions
56-
// for Worker and JobWorker.
55+
// - runtime: *datav1alpha1.AlluxioRuntime, the runtime configuration of Alluxio, including resource definitions
56+
// for Worker and JobWorker.
5757
// - value: *Alluxio, the Alluxio runtime instance used to store the transformed resource information.
58-
//
58+
//
5959
// Return value:
6060
// - error: Returns an error if any issue occurs during resource transformation; otherwise, returns nil.
6161
func (e *AlluxioEngine) transformResourcesForWorker(runtime *datav1alpha1.AlluxioRuntime, value *Alluxio) error {

pkg/ddc/alluxio/transform_resources_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ func TestTransformResourcesForWorkerWithTieredStore(t *testing.T) {
218218

219219
// Test cases structured to validate different tiered storage configurations
220220
var tests = []struct {
221-
runtime *datav1alpha1.AlluxioRuntime // Input Alluxio runtime configuration
222-
alluxioValue *Alluxio // Expected output configuration
221+
runtime *datav1alpha1.AlluxioRuntime // Input Alluxio runtime configuration
222+
alluxioValue *Alluxio // Expected output configuration
223223
}{
224224
{&datav1alpha1.AlluxioRuntime{
225225
ObjectMeta: metav1.ObjectMeta{
@@ -229,20 +229,20 @@ func TestTransformResourcesForWorkerWithTieredStore(t *testing.T) {
229229
Spec: datav1alpha1.AlluxioRuntimeSpec{
230230
TieredStore: datav1alpha1.TieredStore{
231231
Levels: []datav1alpha1.Level{{
232-
MediumType: common.Memory, // Memory-based tiered storage configuration
232+
MediumType: common.Memory, // Memory-based tiered storage configuration
233233
Quota: &result, // 20Gi quota allocation
234234
}},
235235
},
236236
},
237237
}, &Alluxio{
238-
Properties: map[string]string{}, // Expected empty properties map
238+
Properties: map[string]string{}, // Expected empty properties map
239239
}},
240240
}
241241
// Iterate through test cases to validate transformation logic
242242
for _, test := range tests {
243243
// Initialize test environment with mocked dependencies
244244
engine := &AlluxioEngine{
245-
Log: fake.NullLogger(), // Discard logging output
245+
Log: fake.NullLogger(), // Discard logging output
246246
name: "test",
247247
namespace: "test",
248248
}
@@ -472,12 +472,12 @@ func TestTransformResourcesForWorkerWithOnlyRequest(t *testing.T) {
472472
// resource requests are handled as expected.
473473
//
474474
// The function performs the following steps:
475-
// 1. Defines resource requirements with limits for memory (20Gi) and CPU (500m).
476-
// 2. Sets up test cases to validate the transformation logic, including scenarios with and without
477-
// tiered store configurations.
478-
// 3. Initializes an AlluxioEngine instance with a fake client and runtime objects for testing.
479-
// 4. Transforms the resource requirements for the worker using the AlluxioEngine.
480-
// 5. Validates the transformed resource limits and requests against the expected results.
475+
// 1. Defines resource requirements with limits for memory (20Gi) and CPU (500m).
476+
// 2. Sets up test cases to validate the transformation logic, including scenarios with and without
477+
// tiered store configurations.
478+
// 3. Initializes an AlluxioEngine instance with a fake client and runtime objects for testing.
479+
// 4. Transforms the resource requirements for the worker using the AlluxioEngine.
480+
// 5. Validates the transformed resource limits and requests against the expected results.
481481
//
482482
// Test cases include:
483483
// - A scenario where tiered store configuration is provided, ensuring memory limits and requests are set correctly.

pkg/ddc/alluxio/transform_test.go

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ func TestTransformMaster(t *testing.T) {
183183
}
184184
}
185185

186-
// TestTransformWorkers verifies that the transformWorkers function correctly transforms
187-
// the worker configuration of AlluxioRuntime into the expected Alluxio structure.
188-
// It tests different network modes, node selectors, and image pull secrets to ensure
186+
// TestTransformWorkers verifies that the transformWorkers function correctly transforms
187+
// the worker configuration of AlluxioRuntime into the expected Alluxio structure.
188+
// It tests different network modes, node selectors, and image pull secrets to ensure
189189
// correct transformation behavior.
190190
func TestTransformWorkers(t *testing.T) {
191191
testCases := map[string]struct {
@@ -588,19 +588,21 @@ func TestGetMediumTypeFromVolumeSource(t *testing.T) {
588588
}
589589
}
590590

591-
// TestAlluxioEngine_allocateSinglePort is a unit test function that tests
591+
// TestAlluxioEngine_allocateSinglePort is a unit test function that tests
592592
// the `allocateSinglePort` method of the `AlluxioEngine` struct.
593-
// The function verifies the behavior of port allocation for Alluxio master
593+
// The function verifies the behavior of port allocation for Alluxio master
594594
// and worker components under different scenarios,
595-
// including when properties are set, unset, or when runtime specifications
595+
// including when properties are set, unset, or when runtime specifications
596596
// are provided.
597-
//
597+
//
598598
// Parameters:
599-
// - t: A testing.T object provided by the Go testing framework, used to
599+
// - t: A testing.T object provided by the Go testing framework, used to
600+
//
600601
// manage test state and support formatted test logs.
601602
//
602603
// Returns:
603-
// - None. The function is a test function and does not return any value.
604+
// - None. The function is a test function and does not return any value.
605+
//
604606
// It reports test failures using the `t.Errorf` method.
605607
func TestAlluxioEngine_allocateSinglePort(t *testing.T) {
606608
// Define the fields required for the AlluxioEngine struct.
@@ -902,10 +904,10 @@ func TestAlluxioEngine_allocatePorts(t *testing.T) {
902904
//
903905
// Test Cases:
904906
// 1. "master properties is not null":
905-
// - Ensures that when master-specific properties exist, they override the global properties.
907+
// - Ensures that when master-specific properties exist, they override the global properties.
906908
//
907909
// 2. "properties is not null for master":
908-
// - Ensures that both master-specific and additional global properties are correctly handled.
910+
// - Ensures that both master-specific and additional global properties are correctly handled.
909911
//
910912
// The function iterates over multiple test cases and checks if the transformed properties
911913
// match the expected values. If the transformation does not produce the expected result, the test fails.

pkg/ddc/alluxio/transform_ufs_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import (
2323
v1 "k8s.io/api/core/v1"
2424
)
2525

26-
// TestTransformDatasetToVolume is a unit test function that verifies the transformation of a Dataset into a UFSPath
27-
// in the Alluxio runtime. It ensures that the Dataset's mount points are correctly converted into corresponding
26+
// TestTransformDatasetToVolume is a unit test function that verifies the transformation of a Dataset into a UFSPath
27+
// in the Alluxio runtime. It ensures that the Dataset's mount points are correctly converted into corresponding
2828
// container and host paths.
2929
//
3030
// Parameters:
@@ -60,7 +60,7 @@ func TestTransformDatasetToVolume(t *testing.T) {
6060
}},
6161
},
6262
}, &Alluxio{}, ufsPath},
63-
63+
6464
// Test case 2: Mount with a path specified
6565
{&datav1alpha1.AlluxioRuntime{}, &datav1alpha1.Dataset{
6666
Spec: datav1alpha1.DatasetSpec{
@@ -72,7 +72,7 @@ func TestTransformDatasetToVolume(t *testing.T) {
7272
},
7373
}, &Alluxio{}, ufsPath1},
7474
}
75-
75+
7676
// Iterate through all test cases and run the test.
7777
for _, test := range tests {
7878
// Create an instance of AlluxioEngine to call the function under test.

pkg/ddc/alluxio/utils_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,17 @@ func Test_lookUpUsedCapacity(t *testing.T) {
222222
node corev1.Node
223223
usedCapacityMap map[string]int64
224224
}
225-
225+
226226
internalIP := "192.168.1.147"
227227
var usageForInternalIP int64 = 1024
228-
228+
229229
internalHost := "slave001"
230230
var usageForInternalHost int64 = 4096
231-
231+
232232
usedCapacityMap := map[string]int64{}
233233
usedCapacityMap[internalIP] = usageForInternalIP
234234
usedCapacityMap[internalHost] = usageForInternalHost
235-
235+
236236
tests := []struct {
237237
name string
238238
args args
@@ -485,16 +485,16 @@ func TestGetMasterPod(t *testing.T) {
485485
}
486486
}
487487

488-
// TestGetMasterStatefulset tests the getMasterStatefulset method of the AlluxioEngine struct.
489-
// It verifies that the method correctly retrieves the expected StatefulSet based on the provided
490-
// AlluxioRuntime, name, and namespace. The test includes a sample runtime and expected
491-
// StatefulSet, checking for both successful retrieval and error scenarios.
492-
//
493-
// Parameters:
494-
// - t: The test framework's context, which provides methods for logging and error reporting.
495-
//
496-
// Returns:
497-
// - The test does not return any value, but it reports errors using the t.Error and
488+
// TestGetMasterStatefulset tests the getMasterStatefulset method of the AlluxioEngine struct.
489+
// It verifies that the method correctly retrieves the expected StatefulSet based on the provided
490+
// AlluxioRuntime, name, and namespace. The test includes a sample runtime and expected
491+
// StatefulSet, checking for both successful retrieval and error scenarios.
492+
//
493+
// Parameters:
494+
// - t: The test framework's context, which provides methods for logging and error reporting.
495+
//
496+
// Returns:
497+
// - The test does not return any value, but it reports errors using the t.Error and
498498
// t.Errorf methods to indicate whether the test passed or failed.
499499
func TestGetMasterStatefulset(t *testing.T) {
500500
type fields struct {

0 commit comments

Comments
 (0)