cubefs

Форк
0
/
lc_scanner_test.go 
54 строки · 1.7 Кб
1
// Copyright 2023 The CubeFS Authors.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
// implied. See the License for the specific language governing
13
// permissions and limitations under the License.
14

15
package lcnode
16

17
import (
18
	"testing"
19
	"time"
20

21
	"github.com/cubefs/cubefs/proto"
22
	"github.com/cubefs/cubefs/util/routinepool"
23
	"github.com/cubefs/cubefs/util/unboundedchan"
24
	"github.com/stretchr/testify/require"
25
)
26

27
func TestLcScanner(t *testing.T) {
28
	lcScanRoutineNumPerTask = 1
29
	scanCheckInterval = 1
30
	scanner := &LcScanner{
31
		ID:     "test_id",
32
		Volume: "test_vol",
33
		mw:     NewMockMetaWrapper(),
34
		lcnode: &LcNode{},
35
		adminTask: &proto.AdminTask{
36
			Response: &proto.LcNodeRuleTaskResponse{},
37
		},
38
		rule: &proto.Rule{
39
			Expire: &proto.ExpirationConfig{},
40
		},
41
		dirChan:       unboundedchan.NewUnboundedChan(10),
42
		fileChan:      unboundedchan.NewUnboundedChan(10),
43
		dirRPoll:      routinepool.NewRoutinePool(lcScanRoutineNumPerTask),
44
		fileRPoll:     routinepool.NewRoutinePool(lcScanRoutineNumPerTask),
45
		batchDentries: proto.NewBatchDentries(),
46
		currentStat:   &proto.LcNodeRuleTaskStatistics{},
47
		now:           time.Now(),
48
		stopC:         make(chan bool),
49
	}
50
	err := scanner.Start()
51
	require.NoError(t, err)
52
	time.Sleep(time.Second * 5)
53
	require.Equal(t, true, scanner.DoneScanning())
54
}
55

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.