mirror of
https://github.com/minio/minio.git
synced 2024-12-30 17:13:20 -05:00
c829e3a13b
With this change, MinIO's ILM supports transitioning objects to a remote tier. This change includes support for Azure Blob Storage, AWS S3 compatible object storage incl. MinIO and Google Cloud Storage as remote tier storage backends. Some new additions include: - Admin APIs remote tier configuration management - Simple journal to track remote objects to be 'collected' This is used by object API handlers which 'mutate' object versions by overwriting/replacing content (Put/CopyObject) or removing the version itself (e.g DeleteObjectVersion). - Rework of previous ILM transition to fit the new model In the new model, a storage class (a.k.a remote tier) is defined by the 'remote' object storage type (one of s3, azure, GCS), bucket name and a prefix. * Fixed bugs, review comments, and more unit-tests - Leverage inline small object feature - Migrate legacy objects to the latest object format before transitioning - Fix restore to particular version if specified - Extend SharedDataDirCount to handle transitioned and restored objects - Restore-object should accept version-id for version-suspended bucket (#12091) - Check if remote tier creds have sufficient permissions - Bonus minor fixes to existing error messages Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io> Co-authored-by: Krishna Srinivas <krishna@minio.io> Signed-off-by: Harshavardhana <harsha@minio.io>
152 lines
4.0 KiB
JavaScript
152 lines
4.0 KiB
JavaScript
/*
|
|
* Copyright (c) 2015-2021 MinIO, Inc.
|
|
*
|
|
* This file is part of MinIO Object Storage stack
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import reducer from "../reducer"
|
|
import * as actions from "../actions"
|
|
import { SORT_ORDER_ASC, SORT_BY_NAME } from "../../constants"
|
|
|
|
describe("objects reducer", () => {
|
|
it("should return the initial state", () => {
|
|
const initialState = reducer(undefined, {})
|
|
expect(initialState).toEqual({
|
|
list: [],
|
|
filter: "",
|
|
listLoading: false,
|
|
sortBy: "",
|
|
sortOrder: SORT_ORDER_ASC,
|
|
currentPrefix: "",
|
|
prefixWritable: false,
|
|
shareObject: {
|
|
show: false,
|
|
object: "",
|
|
url: ""
|
|
},
|
|
checkedList: []
|
|
})
|
|
})
|
|
|
|
it("should handle SET_LIST", () => {
|
|
const newState = reducer(undefined, {
|
|
type: actions.SET_LIST,
|
|
objects: [{ name: "obj1" }, { name: "obj2" }]
|
|
})
|
|
expect(newState.list).toEqual([{ name: "obj1" }, { name: "obj2" }])
|
|
})
|
|
|
|
it("should handle REMOVE", () => {
|
|
const newState = reducer(
|
|
{ list: [{ name: "obj1" }, { name: "obj2" }] },
|
|
{
|
|
type: actions.REMOVE,
|
|
object: "obj1"
|
|
}
|
|
)
|
|
expect(newState.list).toEqual([{ name: "obj2" }])
|
|
})
|
|
|
|
it("should handle REMOVE with non-existent object", () => {
|
|
const newState = reducer(
|
|
{ list: [{ name: "obj1" }, { name: "obj2" }] },
|
|
{
|
|
type: actions.REMOVE,
|
|
object: "obj3"
|
|
}
|
|
)
|
|
expect(newState.list).toEqual([{ name: "obj1" }, { name: "obj2" }])
|
|
})
|
|
|
|
it("should handle SET_SORT_BY", () => {
|
|
const newState = reducer(undefined, {
|
|
type: actions.SET_SORT_BY,
|
|
sortBy: SORT_BY_NAME
|
|
})
|
|
expect(newState.sortBy).toEqual(SORT_BY_NAME)
|
|
})
|
|
|
|
it("should handle SET_SORT_ORDER", () => {
|
|
const newState = reducer(undefined, {
|
|
type: actions.SET_SORT_ORDER,
|
|
sortOrder: SORT_ORDER_ASC
|
|
})
|
|
expect(newState.sortOrder).toEqual(SORT_ORDER_ASC)
|
|
})
|
|
|
|
it("should handle SET_CURRENT_PREFIX", () => {
|
|
const newState = reducer(
|
|
{ currentPrefix: "test1/" },
|
|
{
|
|
type: actions.SET_CURRENT_PREFIX,
|
|
prefix: "test2/"
|
|
}
|
|
)
|
|
expect(newState.currentPrefix).toEqual("test2/")
|
|
})
|
|
|
|
it("should handle SET_PREFIX_WRITABLE", () => {
|
|
const newState = reducer(undefined, {
|
|
type: actions.SET_PREFIX_WRITABLE,
|
|
prefixWritable: true
|
|
})
|
|
expect(newState.prefixWritable).toBeTruthy()
|
|
})
|
|
|
|
it("should handle SET_SHARE_OBJECT", () => {
|
|
const newState = reducer(undefined, {
|
|
type: actions.SET_SHARE_OBJECT,
|
|
show: true,
|
|
object: "a.txt",
|
|
url: "test"
|
|
})
|
|
expect(newState.shareObject).toEqual({
|
|
show: true,
|
|
object: "a.txt",
|
|
url: "test"
|
|
})
|
|
})
|
|
|
|
it("should handle CHECKED_LIST_ADD", () => {
|
|
const newState = reducer(undefined, {
|
|
type: actions.CHECKED_LIST_ADD,
|
|
object: "obj1"
|
|
})
|
|
expect(newState.checkedList).toEqual(["obj1"])
|
|
})
|
|
|
|
it("should handle SELECTED_LIST_REMOVE", () => {
|
|
const newState = reducer(
|
|
{ checkedList: ["obj1", "obj2"] },
|
|
{
|
|
type: actions.CHECKED_LIST_REMOVE,
|
|
object: "obj1"
|
|
}
|
|
)
|
|
expect(newState.checkedList).toEqual(["obj2"])
|
|
})
|
|
|
|
it("should handle CHECKED_LIST_RESET", () => {
|
|
const newState = reducer(
|
|
{ checkedList: ["obj1", "obj2"] },
|
|
{
|
|
type: actions.CHECKED_LIST_RESET
|
|
}
|
|
)
|
|
expect(newState.checkedList).toEqual([])
|
|
})
|
|
})
|