CloudMigrations: remove unused code from sync migration approach (#93430)
This commit is contained in:
@@ -253,132 +253,6 @@ func TestCloudMigrationAPI_CreateMigration(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloudMigrationAPI_RunMigration(t *testing.T) {
|
||||
tests := []TestCase{
|
||||
{
|
||||
desc: "should return 200 if everything is ok",
|
||||
requestHttpMethod: http.MethodPost,
|
||||
requestUrl: "/api/cloudmigration/migration/1234/run",
|
||||
basicRole: org.RoleAdmin,
|
||||
expectedHttpResult: http.StatusOK,
|
||||
expectedBody: `{"uid":"fake_uid","items":[{"type":"type","refId":"make_refid","status":"ok","message":"none"}]}`,
|
||||
},
|
||||
{
|
||||
desc: "should return 403 if no used is not admin",
|
||||
requestHttpMethod: http.MethodPost,
|
||||
requestUrl: "/api/cloudmigration/migration/1234/run",
|
||||
basicRole: org.RoleEditor,
|
||||
expectedHttpResult: http.StatusForbidden,
|
||||
expectedBody: "",
|
||||
},
|
||||
{
|
||||
desc: "should return 500 if service returns an error",
|
||||
requestHttpMethod: http.MethodPost,
|
||||
requestUrl: "/api/cloudmigration/migration/1234/run",
|
||||
basicRole: org.RoleAdmin,
|
||||
serviceReturnError: true,
|
||||
expectedHttpResult: http.StatusInternalServerError,
|
||||
expectedBody: "",
|
||||
},
|
||||
{
|
||||
desc: "should return 400 if uid is invalid",
|
||||
requestHttpMethod: http.MethodPost,
|
||||
requestUrl: "/api/cloudmigration/migration/***/run",
|
||||
basicRole: org.RoleAdmin,
|
||||
serviceReturnError: true,
|
||||
expectedHttpResult: http.StatusBadRequest,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.desc, runSimpleApiTest(tt))
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloudMigrationAPI_GetMigrationRun(t *testing.T) {
|
||||
tests := []TestCase{
|
||||
{
|
||||
desc: "should return 200 if everything is ok",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/run/1234",
|
||||
basicRole: org.RoleAdmin,
|
||||
expectedHttpResult: http.StatusOK,
|
||||
expectedBody: `{"uid":"fake_uid","items":[{"type":"type","refId":"make_refid","status":"ok","message":"none"}]}`,
|
||||
},
|
||||
{
|
||||
desc: "should return 403 if no used is not admin",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/run/1234",
|
||||
basicRole: org.RoleEditor,
|
||||
expectedHttpResult: http.StatusForbidden,
|
||||
expectedBody: "",
|
||||
},
|
||||
{
|
||||
desc: "should return 500 if service returns an error",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/run/1234",
|
||||
basicRole: org.RoleAdmin,
|
||||
serviceReturnError: true,
|
||||
expectedHttpResult: http.StatusInternalServerError,
|
||||
expectedBody: "",
|
||||
},
|
||||
{
|
||||
desc: "should return 400 if uid is invalid",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/run/****",
|
||||
basicRole: org.RoleAdmin,
|
||||
serviceReturnError: true,
|
||||
expectedHttpResult: http.StatusBadRequest,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.desc, runSimpleApiTest(tt))
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloudMigrationAPI_GetMigrationRunList(t *testing.T) {
|
||||
tests := []TestCase{
|
||||
{
|
||||
desc: "should return 200 if everything is ok",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/1234/run",
|
||||
basicRole: org.RoleAdmin,
|
||||
expectedHttpResult: http.StatusOK,
|
||||
expectedBody: `{"runs":[{"uid":"fake_run_uid_1"},{"uid":"fake_run_uid_2"}]}`,
|
||||
},
|
||||
{
|
||||
desc: "should return 403 if no used is not admin",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/1234/run",
|
||||
basicRole: org.RoleEditor,
|
||||
expectedHttpResult: http.StatusForbidden,
|
||||
expectedBody: "",
|
||||
},
|
||||
{
|
||||
desc: "should return 500 if service returns an error",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/1234/run",
|
||||
basicRole: org.RoleAdmin,
|
||||
serviceReturnError: true,
|
||||
expectedHttpResult: http.StatusInternalServerError,
|
||||
expectedBody: "",
|
||||
},
|
||||
{
|
||||
desc: "should return 400 if uid is invalid",
|
||||
requestHttpMethod: http.MethodGet,
|
||||
requestUrl: "/api/cloudmigration/migration/****/run",
|
||||
basicRole: org.RoleAdmin,
|
||||
serviceReturnError: true,
|
||||
expectedHttpResult: http.StatusBadRequest,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.desc, runSimpleApiTest(tt))
|
||||
}
|
||||
}
|
||||
|
||||
func TestCloudMigrationAPI_DeleteMigration(t *testing.T) {
|
||||
tests := []TestCase{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user