mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-30 14:13:43 +01:00
Merge pull request #4507 from vmware/steven_job_service
Fix the issue of causing config test failed
This commit is contained in:
commit
d183226570
@ -82,8 +82,8 @@ func TestDefaultConfig(t *testing.T) {
|
|||||||
t.Errorf("Load config from yaml file, expect nil error but got error '%s'\n", err)
|
t.Errorf("Load config from yaml file, expect nil error but got error '%s'\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if endpoint := GetAdminServerEndpoint(); endpoint != "http://127.0.0.1:8888/" {
|
if endpoint := GetAdminServerEndpoint(); endpoint != "http://127.0.0.1:8888" {
|
||||||
t.Errorf("expect default admin server endpoint 'http://127.0.0.1:8888/' but got '%s'\n", endpoint)
|
t.Errorf("expect default admin server endpoint 'http://127.0.0.1:8888' but got '%s'\n", endpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
if basePath := GetLogBasePath(); basePath != "/tmp/job_logs" {
|
if basePath := GetLogBasePath(); basePath != "/tmp/job_logs" {
|
||||||
|
@ -28,5 +28,5 @@ logger:
|
|||||||
archive_period: 1 #days
|
archive_period: 1 #days
|
||||||
|
|
||||||
#Admin server endpoint
|
#Admin server endpoint
|
||||||
admin_server: "http://127.0.0.1:8888/"
|
admin_server: "http://127.0.0.1:8888"
|
||||||
|
|
||||||
|
@ -15,10 +15,6 @@ import (
|
|||||||
"github.com/vmware/harbor/src/jobservice_v2/errs"
|
"github.com/vmware/harbor/src/jobservice_v2/errs"
|
||||||
"github.com/vmware/harbor/src/jobservice_v2/logger"
|
"github.com/vmware/harbor/src/jobservice_v2/logger"
|
||||||
|
|
||||||
"github.com/vmware/harbor/src/jobservice_v2/period"
|
|
||||||
|
|
||||||
"github.com/gocraft/work"
|
|
||||||
|
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
"github.com/vmware/harbor/src/jobservice_v2/job"
|
"github.com/vmware/harbor/src/jobservice_v2/job"
|
||||||
"github.com/vmware/harbor/src/jobservice_v2/models"
|
"github.com/vmware/harbor/src/jobservice_v2/models"
|
||||||
@ -56,9 +52,6 @@ type RedisJobStatsManager struct {
|
|||||||
namespace string
|
namespace string
|
||||||
redisPool *redis.Pool
|
redisPool *redis.Pool
|
||||||
context context.Context
|
context context.Context
|
||||||
client *work.Client
|
|
||||||
scheduler period.Interface
|
|
||||||
|
|
||||||
stopChan chan struct{}
|
stopChan chan struct{}
|
||||||
doneChan chan struct{}
|
doneChan chan struct{}
|
||||||
processChan chan *queueItem
|
processChan chan *queueItem
|
||||||
@ -67,13 +60,11 @@ type RedisJobStatsManager struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//NewRedisJobStatsManager is constructor of RedisJobStatsManager
|
//NewRedisJobStatsManager is constructor of RedisJobStatsManager
|
||||||
func NewRedisJobStatsManager(ctx context.Context, namespace string, redisPool *redis.Pool, client *work.Client, scheduler period.Interface) *RedisJobStatsManager {
|
func NewRedisJobStatsManager(ctx context.Context, namespace string, redisPool *redis.Pool) *RedisJobStatsManager {
|
||||||
return &RedisJobStatsManager{
|
return &RedisJobStatsManager{
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
context: ctx,
|
context: ctx,
|
||||||
redisPool: redisPool,
|
redisPool: redisPool,
|
||||||
client: client,
|
|
||||||
scheduler: scheduler,
|
|
||||||
stopChan: make(chan struct{}, 1),
|
stopChan: make(chan struct{}, 1),
|
||||||
doneChan: make(chan struct{}, 1),
|
doneChan: make(chan struct{}, 1),
|
||||||
processChan: make(chan *queueItem, processBufferSize),
|
processChan: make(chan *queueItem, processBufferSize),
|
||||||
|
@ -61,7 +61,7 @@ func NewGoCraftWorkPool(ctx *env.Context, namespace string, workerCount uint, re
|
|||||||
client := work.NewClient(namespace, redisPool)
|
client := work.NewClient(namespace, redisPool)
|
||||||
scheduler := period.NewRedisPeriodicScheduler(ctx, namespace, redisPool)
|
scheduler := period.NewRedisPeriodicScheduler(ctx, namespace, redisPool)
|
||||||
sweeper := period.NewSweeper(namespace, redisPool, client)
|
sweeper := period.NewSweeper(namespace, redisPool, client)
|
||||||
statsMgr := opm.NewRedisJobStatsManager(ctx.SystemContext, namespace, redisPool, client, scheduler)
|
statsMgr := opm.NewRedisJobStatsManager(ctx.SystemContext, namespace, redisPool)
|
||||||
msgServer := NewMessageServer(ctx.SystemContext, namespace, redisPool)
|
msgServer := NewMessageServer(ctx.SystemContext, namespace, redisPool)
|
||||||
return &GoCraftWorkPool{
|
return &GoCraftWorkPool{
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
|
Loading…
Reference in New Issue
Block a user