[Agent][Deploy] - 修改ImageSync模块 大量修改
This commit is contained in:
@@ -22,7 +22,7 @@ func TestFetchDependencyRepos_Middle(t *testing.T) {
|
||||
|
||||
func TestFetchDependencyRepos_RKE(t *testing.T) {
|
||||
|
||||
errorPullImageList, errorGzipImageList, realCmiiImageName, allGzipFileNameList := C_DownloadCompressUploadDependency(true, false, true)
|
||||
errorPullImageList, errorGzipImageList, realCmiiImageName, allGzipFileNameList := C_DownloadCompressUploadDependency(true, true, false)
|
||||
|
||||
utils.BeautifulPrintListWithTitle(errorPullImageList, "errorPullImageList")
|
||||
utils.BeautifulPrintListWithTitle(errorGzipImageList, "errorGzipImageList")
|
||||
@@ -48,17 +48,28 @@ func TestLoadSplitDepGzipImageToTargetHarbor(t *testing.T) {
|
||||
func TestPullFromEntityAndSyncConditionally(t *testing.T) {
|
||||
// 创建一个模拟的sync对象,用于测试函数的行为。这里需要根据你的实际需求来设置mock数据和预期结果。
|
||||
sync := ImageSyncEntity{
|
||||
CmiiNameTagList: []string{
|
||||
//"cmii-uav-mqtthandler:5.4.0-bjdyt-052102",
|
||||
DownloadCondition: &DownloadEntity{
|
||||
ShouldDownloadImage: true,
|
||||
ProjectName: "bjyd",
|
||||
ProjectVersion: "",
|
||||
CmiiNameTagList: []string{
|
||||
//"cmii-uav-mqtthandler:5.4.0-bjdyt-052102",
|
||||
},
|
||||
FullNameImageList: nil,
|
||||
DownloadAuthUserName: "",
|
||||
DownloadAuthPassword: "",
|
||||
},
|
||||
FullNameImageList: nil,
|
||||
ProjectVersion: "",
|
||||
ProjectName: "bjtg",
|
||||
DirectHarborHost: "harbor.wdd.io:8033",
|
||||
ShouldDownloadImage: false,
|
||||
ShouldCompressImageToGzip: false,
|
||||
ShouldUploadToDemoMinio: false,
|
||||
ShouldDirectPushToHarbor: true,
|
||||
|
||||
CompressCondition: &CompressEntity{
|
||||
ShouldCompressImageToGzip: true,
|
||||
ShouldGzipSplit: true,
|
||||
GzipLocalFolder: "",
|
||||
},
|
||||
UploadCondition: &UploadEntity{
|
||||
ShouldUploadToDemoMinio: true,
|
||||
},
|
||||
DirectHarborHost: "harbor.wdd.io:8033",
|
||||
ShouldDirectPushToHarbor: false,
|
||||
}
|
||||
|
||||
// 调用函数并获取结果。这里需要根据你的实际需求来验证返回的结果是否符合预期。
|
||||
@@ -67,9 +78,6 @@ func TestPullFromEntityAndSyncConditionally(t *testing.T) {
|
||||
utils.BeautifulPrint(result)
|
||||
|
||||
// 添加断言以检查函数的输出,例如:
|
||||
if len(result.ErrorPullImageList) != 0 {
|
||||
t.Errorf("Expected no error pulling images, got %v", result.ErrorPullImageList)
|
||||
}
|
||||
// ...其他验证逻辑...
|
||||
}
|
||||
|
||||
@@ -110,7 +118,15 @@ func TestConcatAndUniformCmiiImage(t *testing.T) {
|
||||
|
||||
func TestImageSyncEntity_PullFromEntityAndSyncConditionally(t *testing.T) {
|
||||
imageSyncEntity := ImageSyncEntity{
|
||||
ProjectVersion: "5.4.0",
|
||||
DownloadCondition: &DownloadEntity{
|
||||
ShouldDownloadImage: true,
|
||||
ProjectName: "",
|
||||
ProjectVersion: "5.4.0",
|
||||
CmiiNameTagList: nil,
|
||||
FullNameImageList: nil,
|
||||
DownloadAuthUserName: "",
|
||||
DownloadAuthPassword: "",
|
||||
},
|
||||
DirectHarborHost: "36.134.71.138",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user