Skip to content

Commit 116cf68

Browse files
committed
Merge branch 'main' into freebsd_support
2 parents d7522c3 + 2aab22a commit 116cf68

File tree

8 files changed

+46
-37
lines changed

8 files changed

+46
-37
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
# A CODEOWNERS file uses a pattern that follows the same rules used in gitignore files.
2-
# The pattern is followed by one or more GitHub usernames or team names using the
3-
# standard @username or @org/team-name format. You can also refer to a user by an
4-
# email address that has been added to their GitHub account, for example user@example.com
5-
6-
* @dragonflyoss/dragonfly-approvers
1+
* @dragonflyoss/dragonfly-maintainers @dragonflyoss/dragonfly-approvers
72
.github @dragonflyoss/dragonfly-maintainers

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
sudo ip addr
3838
3939
- name: Run Unit tests
40+
env:
41+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
42+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
4043
run: |-
4144
# switch to installed go
4245
sudo ln -sf `which go` `sudo which go`

internal/job/image_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@ package job
1818

1919
import (
2020
"context"
21+
"os"
2122
"testing"
2223
"time"
2324

2425
"github.com/stretchr/testify/assert"
2526
)
2627

2728
func TestPreheat_CreatePreheatRequestsByManifestURL(t *testing.T) {
29+
username := os.Getenv("DOCKER_USERNAME")
30+
password := os.Getenv("DOCKER_PASSWORD")
31+
if username == "" || password == "" {
32+
t.Skip("DOCKER_USERNAME or DOCKER_PASSWORD is not set, skipping test")
33+
}
34+
2835
tests := []struct {
2936
name string
3037
req *ManifestRequest
@@ -34,6 +41,8 @@ func TestPreheat_CreatePreheatRequestsByManifestURL(t *testing.T) {
3441
name: "get image layers with manifest url",
3542
req: &ManifestRequest{
3643
URL: "https://registry-1.docker.io/v2/dragonflyoss/busybox/manifests/1.35.0",
44+
Username: username,
45+
Password: password,
3746
Timeout: 30 * time.Second,
3847
InsecureSkipVerify: true,
3948
},
@@ -47,6 +56,8 @@ func TestPreheat_CreatePreheatRequestsByManifestURL(t *testing.T) {
4756
req: &ManifestRequest{
4857
URL: "https://registry-1.docker.io/v2/dragonflyoss/scheduler/manifests/v2.1.0",
4958
Platform: "linux/amd64",
59+
Username: username,
60+
Password: password,
5061
Timeout: 30 * time.Second,
5162
InsecureSkipVerify: true,
5263
},

scheduler/resource/persistent/host_manager.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (h *hostManager) Load(ctx context.Context, hostID string) (*Host, bool) {
150150
return nil, false
151151
}
152152

153-
cpuProcessPercent, err := strconv.ParseFloat(rawHost["cpu_processe_percent"], 64)
153+
cpuProcessPercent, err := strconv.ParseFloat(rawHost["cpu_process_percent"], 64)
154154
if err != nil {
155155
log.Errorf("parsing cpu process percent failed: %v", err)
156156
return nil, false
@@ -260,7 +260,7 @@ func (h *hostManager) Load(ctx context.Context, hostID string) (*Host, bool) {
260260
return nil, false
261261
}
262262

263-
memoryProcessUsedPercent, err := strconv.ParseFloat(rawHost["memory_processe_used_percent"], 64)
263+
memoryProcessUsedPercent, err := strconv.ParseFloat(rawHost["memory_process_used_percent"], 64)
264264
if err != nil {
265265
log.Errorf("parsing memory process used percent failed: %v", err)
266266
return nil, false
@@ -546,7 +546,7 @@ redis.call("HSET", host_key,
546546
"cpu_logical_count", cpu_logical_count,
547547
"cpu_physical_count", cpu_physical_count,
548548
"cpu_percent", cpu_percent,
549-
"cpu_processe_percent", cpu_process_percent,
549+
"cpu_process_percent", cpu_process_percent,
550550
"cpu_times_user", cpu_times_user,
551551
"cpu_times_system", cpu_times_system,
552552
"cpu_times_idle", cpu_times_idle,
@@ -561,7 +561,7 @@ redis.call("HSET", host_key,
561561
"memory_available", memory_available,
562562
"memory_used", memory_used,
563563
"memory_used_percent", memory_used_percent,
564-
"memory_processe_used_percent", memory_process_used_percent,
564+
"memory_process_used_percent", memory_process_used_percent,
565565
"memory_free", memory_free,
566566
"network_tcp_connection_count", network_tcp_connection_count,
567567
"network_upload_tcp_connection_count", network_upload_tcp_connection_count,

scheduler/resource/persistent/host_manager_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestHostManager_Load(t *testing.T) {
6464
"cpu_logical_count": "4",
6565
"cpu_physical_count": "2",
6666
"cpu_percent": "50.0",
67-
"cpu_processe_percent": "25.0",
67+
"cpu_process_percent": "25.0",
6868
"cpu_times_user": "10.0",
6969
"cpu_times_system": "5.0",
7070
"cpu_times_idle": "100.0",
@@ -79,7 +79,7 @@ func TestHostManager_Load(t *testing.T) {
7979
"memory_available": "4000000000",
8080
"memory_used": "4000000000",
8181
"memory_used_percent": "50.0",
82-
"memory_processe_used_percent": "25.0",
82+
"memory_process_used_percent": "25.0",
8383
"memory_free": "2000000000",
8484
"network_tcp_connection_count": "100",
8585
"network_upload_tcp_connection_count": "50",
@@ -411,7 +411,7 @@ func TestHostManager_LoadAll(t *testing.T) {
411411
"cpu_logical_count": "4",
412412
"cpu_physical_count": "2",
413413
"cpu_percent": "50.0",
414-
"cpu_processe_percent": "25.0",
414+
"cpu_process_percent": "25.0",
415415
"cpu_times_user": "10.0",
416416
"cpu_times_system": "5.0",
417417
"cpu_times_idle": "100.0",
@@ -426,7 +426,7 @@ func TestHostManager_LoadAll(t *testing.T) {
426426
"memory_available": "4000000000",
427427
"memory_used": "4000000000",
428428
"memory_used_percent": "50.0",
429-
"memory_processe_used_percent": "25.0",
429+
"memory_process_used_percent": "25.0",
430430
"memory_free": "2000000000",
431431
"network_tcp_connection_count": "100",
432432
"network_upload_tcp_connection_count": "50",
@@ -486,7 +486,7 @@ func TestHostManager_LoadAll(t *testing.T) {
486486
"cpu_logical_count": "4",
487487
"cpu_physical_count": "2",
488488
"cpu_percent": "50.0",
489-
"cpu_processe_percent": "25.0",
489+
"cpu_process_percent": "25.0",
490490
"cpu_times_user": "10.0",
491491
"cpu_times_system": "5.0",
492492
"cpu_times_idle": "100.0",
@@ -501,7 +501,7 @@ func TestHostManager_LoadAll(t *testing.T) {
501501
"memory_available": "4000000000",
502502
"memory_used": "4000000000",
503503
"memory_used_percent": "50.0",
504-
"memory_processe_used_percent": "25.0",
504+
"memory_process_used_percent": "25.0",
505505
"memory_free": "2000000000",
506506
"network_tcp_connection_count": "100",
507507
"network_upload_tcp_connection_count": "50",
@@ -551,7 +551,7 @@ func TestHostManager_LoadAll(t *testing.T) {
551551
"cpu_logical_count": "4",
552552
"cpu_physical_count": "2",
553553
"cpu_percent": "50.0",
554-
"cpu_processe_percent": "25.0",
554+
"cpu_process_percent": "25.0",
555555
"cpu_times_user": "10.0",
556556
"cpu_times_system": "5.0",
557557
"cpu_times_idle": "100.0",
@@ -566,7 +566,7 @@ func TestHostManager_LoadAll(t *testing.T) {
566566
"memory_available": "4000000000",
567567
"memory_used": "4000000000",
568568
"memory_used_percent": "50.0",
569-
"memory_processe_used_percent": "25.0",
569+
"memory_process_used_percent": "25.0",
570570
"memory_free": "2000000000",
571571
"network_tcp_connection_count": "100",
572572
"network_upload_tcp_connection_count": "50",
@@ -739,7 +739,7 @@ func TestHostManager_RunGC(t *testing.T) {
739739
"cpu_logical_count": "4",
740740
"cpu_physical_count": "2",
741741
"cpu_percent": "50.0",
742-
"cpu_processe_percent": "25.0",
742+
"cpu_process_percent": "25.0",
743743
"cpu_times_user": "10.0",
744744
"cpu_times_system": "5.0",
745745
"cpu_times_idle": "100.0",
@@ -754,7 +754,7 @@ func TestHostManager_RunGC(t *testing.T) {
754754
"memory_available": "4000000000",
755755
"memory_used": "4000000000",
756756
"memory_used_percent": "50.0",
757-
"memory_processe_used_percent": "25.0",
757+
"memory_process_used_percent": "25.0",
758758
"memory_free": "2000000000",
759759
"network_tcp_connection_count": "100",
760760
"network_upload_tcp_connection_count": "50",

scheduler/resource/persistentcache/host_manager.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"strconv"
2525
"time"
2626

27-
redis "github.com/redis/go-redis/v9"
27+
"github.com/redis/go-redis/v9"
2828

2929
logger "d7y.io/dragonfly/v2/internal/dflog"
3030
"d7y.io/dragonfly/v2/pkg/container/set"
@@ -150,7 +150,7 @@ func (h *hostManager) Load(ctx context.Context, hostID string) (*Host, bool) {
150150
return nil, false
151151
}
152152

153-
cpuProcessPercent, err := strconv.ParseFloat(rawHost["cpu_processe_percent"], 64)
153+
cpuProcessPercent, err := strconv.ParseFloat(rawHost["cpu_process_percent"], 64)
154154
if err != nil {
155155
log.Errorf("parsing cpu process percent failed: %v", err)
156156
return nil, false
@@ -260,7 +260,7 @@ func (h *hostManager) Load(ctx context.Context, hostID string) (*Host, bool) {
260260
return nil, false
261261
}
262262

263-
memoryProcessUsedPercent, err := strconv.ParseFloat(rawHost["memory_processe_used_percent"], 64)
263+
memoryProcessUsedPercent, err := strconv.ParseFloat(rawHost["memory_process_used_percent"], 64)
264264
if err != nil {
265265
log.Errorf("parsing memory process used percent failed: %v", err)
266266
return nil, false
@@ -546,7 +546,7 @@ redis.call("HSET", host_key,
546546
"cpu_logical_count", cpu_logical_count,
547547
"cpu_physical_count", cpu_physical_count,
548548
"cpu_percent", cpu_percent,
549-
"cpu_processe_percent", cpu_process_percent,
549+
"cpu_process_percent", cpu_process_percent,
550550
"cpu_times_user", cpu_times_user,
551551
"cpu_times_system", cpu_times_system,
552552
"cpu_times_idle", cpu_times_idle,
@@ -561,7 +561,7 @@ redis.call("HSET", host_key,
561561
"memory_available", memory_available,
562562
"memory_used", memory_used,
563563
"memory_used_percent", memory_used_percent,
564-
"memory_processe_used_percent", memory_process_used_percent,
564+
"memory_process_used_percent", memory_process_used_percent,
565565
"memory_free", memory_free,
566566
"network_tcp_connection_count", network_tcp_connection_count,
567567
"network_upload_tcp_connection_count", network_upload_tcp_connection_count,

scheduler/resource/persistentcache/host_manager_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestHostManager_Load(t *testing.T) {
6464
"cpu_logical_count": "4",
6565
"cpu_physical_count": "2",
6666
"cpu_percent": "50.0",
67-
"cpu_processe_percent": "25.0",
67+
"cpu_process_percent": "25.0",
6868
"cpu_times_user": "10.0",
6969
"cpu_times_system": "5.0",
7070
"cpu_times_idle": "100.0",
@@ -79,7 +79,7 @@ func TestHostManager_Load(t *testing.T) {
7979
"memory_available": "4000000000",
8080
"memory_used": "4000000000",
8181
"memory_used_percent": "50.0",
82-
"memory_processe_used_percent": "25.0",
82+
"memory_process_used_percent": "25.0",
8383
"memory_free": "2000000000",
8484
"network_tcp_connection_count": "100",
8585
"network_upload_tcp_connection_count": "50",
@@ -411,7 +411,7 @@ func TestHostManager_LoadAll(t *testing.T) {
411411
"cpu_logical_count": "4",
412412
"cpu_physical_count": "2",
413413
"cpu_percent": "50.0",
414-
"cpu_processe_percent": "25.0",
414+
"cpu_process_percent": "25.0",
415415
"cpu_times_user": "10.0",
416416
"cpu_times_system": "5.0",
417417
"cpu_times_idle": "100.0",
@@ -426,7 +426,7 @@ func TestHostManager_LoadAll(t *testing.T) {
426426
"memory_available": "4000000000",
427427
"memory_used": "4000000000",
428428
"memory_used_percent": "50.0",
429-
"memory_processe_used_percent": "25.0",
429+
"memory_process_used_percent": "25.0",
430430
"memory_free": "2000000000",
431431
"network_tcp_connection_count": "100",
432432
"network_upload_tcp_connection_count": "50",
@@ -486,7 +486,7 @@ func TestHostManager_LoadAll(t *testing.T) {
486486
"cpu_logical_count": "4",
487487
"cpu_physical_count": "2",
488488
"cpu_percent": "50.0",
489-
"cpu_processe_percent": "25.0",
489+
"cpu_process_percent": "25.0",
490490
"cpu_times_user": "10.0",
491491
"cpu_times_system": "5.0",
492492
"cpu_times_idle": "100.0",
@@ -501,7 +501,7 @@ func TestHostManager_LoadAll(t *testing.T) {
501501
"memory_available": "4000000000",
502502
"memory_used": "4000000000",
503503
"memory_used_percent": "50.0",
504-
"memory_processe_used_percent": "25.0",
504+
"memory_process_used_percent": "25.0",
505505
"memory_free": "2000000000",
506506
"network_tcp_connection_count": "100",
507507
"network_upload_tcp_connection_count": "50",
@@ -551,7 +551,7 @@ func TestHostManager_LoadAll(t *testing.T) {
551551
"cpu_logical_count": "4",
552552
"cpu_physical_count": "2",
553553
"cpu_percent": "50.0",
554-
"cpu_processe_percent": "25.0",
554+
"cpu_process_percent": "25.0",
555555
"cpu_times_user": "10.0",
556556
"cpu_times_system": "5.0",
557557
"cpu_times_idle": "100.0",
@@ -566,7 +566,7 @@ func TestHostManager_LoadAll(t *testing.T) {
566566
"memory_available": "4000000000",
567567
"memory_used": "4000000000",
568568
"memory_used_percent": "50.0",
569-
"memory_processe_used_percent": "25.0",
569+
"memory_process_used_percent": "25.0",
570570
"memory_free": "2000000000",
571571
"network_tcp_connection_count": "100",
572572
"network_upload_tcp_connection_count": "50",
@@ -739,7 +739,7 @@ func TestHostManager_RunGC(t *testing.T) {
739739
"cpu_logical_count": "4",
740740
"cpu_physical_count": "2",
741741
"cpu_percent": "50.0",
742-
"cpu_processe_percent": "25.0",
742+
"cpu_process_percent": "25.0",
743743
"cpu_times_user": "10.0",
744744
"cpu_times_system": "5.0",
745745
"cpu_times_idle": "100.0",
@@ -754,7 +754,7 @@ func TestHostManager_RunGC(t *testing.T) {
754754
"memory_available": "4000000000",
755755
"memory_used": "4000000000",
756756
"memory_used_percent": "50.0",
757-
"memory_processe_used_percent": "25.0",
757+
"memory_process_used_percent": "25.0",
758758
"memory_free": "2000000000",
759759
"network_tcp_connection_count": "100",
760760
"network_upload_tcp_connection_count": "50",

scheduler/resource/persistentcache/peer_manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ redis.call("HSET", peer_key,
232232
"cost", cost,
233233
"created_at", created_at,
234234
"updated_at", updated_at,
235-
"concurrent_piece_count", concurrent_piece_count)
235+
"concurrent_piece_count", concurrent_piece_count)
236236
237237
-- Set expiration for the peer key
238238
redis.call("EXPIRE", peer_key, ttl_seconds)
@@ -277,8 +277,8 @@ return true
277277
peer.Cost.Nanoseconds(),
278278
peer.CreatedAt.Format(time.RFC3339),
279279
peer.UpdatedAt.Format(time.RFC3339),
280-
peer.ConcurrentPieceCount,
281280
remainingTTLSeconds,
281+
peer.ConcurrentPieceCount,
282282
}
283283

284284
// Execute the script.

0 commit comments

Comments
 (0)