aboutsummaryrefslogtreecommitdiffstats
path: root/modules/setting/storage_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting/storage_test.go')
-rw-r--r--modules/setting/storage_test.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/modules/setting/storage_test.go b/modules/setting/storage_test.go
index 20886d4c4e..6f38bf1d55 100644
--- a/modules/setting/storage_test.go
+++ b/modules/setting/storage_test.go
@@ -412,3 +412,56 @@ MINIO_USE_SSL = true
assert.EqualValues(t, true, RepoArchive.Storage.MinioConfig.UseSSL)
assert.EqualValues(t, "repo-archive/", RepoArchive.Storage.MinioConfig.BasePath)
}
+
+func Test_getStorageConfiguration28(t *testing.T) {
+ cfg, err := NewConfigProviderFromData(`
+[storage]
+STORAGE_TYPE = minio
+MINIO_ACCESS_KEY_ID = my_access_key
+MINIO_SECRET_ACCESS_KEY = my_secret_key
+MINIO_USE_SSL = true
+MINIO_BASE_PATH = /prefix
+`)
+ assert.NoError(t, err)
+ assert.NoError(t, loadRepoArchiveFrom(cfg))
+ assert.EqualValues(t, "my_access_key", RepoArchive.Storage.MinioConfig.AccessKeyID)
+ assert.EqualValues(t, "my_secret_key", RepoArchive.Storage.MinioConfig.SecretAccessKey)
+ assert.EqualValues(t, true, RepoArchive.Storage.MinioConfig.UseSSL)
+ assert.EqualValues(t, "/prefix/repo-archive/", RepoArchive.Storage.MinioConfig.BasePath)
+
+ cfg, err = NewConfigProviderFromData(`
+[storage]
+STORAGE_TYPE = minio
+MINIO_ACCESS_KEY_ID = my_access_key
+MINIO_SECRET_ACCESS_KEY = my_secret_key
+MINIO_USE_SSL = true
+MINIO_BASE_PATH = /prefix
+
+[lfs]
+MINIO_BASE_PATH = /lfs
+`)
+ assert.NoError(t, err)
+ assert.NoError(t, loadLFSFrom(cfg))
+ assert.EqualValues(t, "my_access_key", LFS.Storage.MinioConfig.AccessKeyID)
+ assert.EqualValues(t, "my_secret_key", LFS.Storage.MinioConfig.SecretAccessKey)
+ assert.EqualValues(t, true, LFS.Storage.MinioConfig.UseSSL)
+ assert.EqualValues(t, "/lfs", LFS.Storage.MinioConfig.BasePath)
+
+ cfg, err = NewConfigProviderFromData(`
+[storage]
+STORAGE_TYPE = minio
+MINIO_ACCESS_KEY_ID = my_access_key
+MINIO_SECRET_ACCESS_KEY = my_secret_key
+MINIO_USE_SSL = true
+MINIO_BASE_PATH = /prefix
+
+[storage.lfs]
+MINIO_BASE_PATH = /lfs
+`)
+ assert.NoError(t, err)
+ assert.NoError(t, loadLFSFrom(cfg))
+ assert.EqualValues(t, "my_access_key", LFS.Storage.MinioConfig.AccessKeyID)
+ assert.EqualValues(t, "my_secret_key", LFS.Storage.MinioConfig.SecretAccessKey)
+ assert.EqualValues(t, true, LFS.Storage.MinioConfig.UseSSL)
+ assert.EqualValues(t, "/lfs", LFS.Storage.MinioConfig.BasePath)
+}