@@ -77,17 +77,22 @@ MINIO_BUCKET = gitea
77
77
func Test_getStorageSpecificOverridesStorage (t * testing.T ) {
78
78
iniStr := `
79
79
[attachment]
80
+ STORAGE_TYPE = minio
80
81
MINIO_BUCKET = gitea-attachment
81
82
82
83
[storage.attachments]
83
84
MINIO_BUCKET = gitea
85
+
86
+ [storage]
87
+ STORAGE_TYPE = local
84
88
`
85
89
Cfg , _ = ini .Load ([]byte (iniStr ))
86
90
87
91
sec := Cfg .Section ("attachment" )
88
92
storageType := sec .Key ("STORAGE_TYPE" ).MustString ("" )
89
93
storage := getStorage ("attachments" , storageType , sec )
90
94
95
+ assert .EqualValues (t , "minio" , storage .Type )
91
96
assert .EqualValues (t , "gitea-attachment" , storage .Section .Key ("MINIO_BUCKET" ).String ())
92
97
}
93
98
@@ -162,3 +167,31 @@ MINIO_BUCKET = gitea-storage
162
167
assert .EqualValues (t , "gitea-storage" , storage .Section .Key ("MINIO_BUCKET" ).String ())
163
168
}
164
169
}
170
+
171
+ func Test_getStorageInheritStorageType (t * testing.T ) {
172
+ iniStr := `
173
+ [storage]
174
+ STORAGE_TYPE = minio
175
+ `
176
+ Cfg , _ = ini .Load ([]byte (iniStr ))
177
+
178
+ sec := Cfg .Section ("attachment" )
179
+ storageType := sec .Key ("STORAGE_TYPE" ).MustString ("" )
180
+ storage := getStorage ("attachments" , storageType , sec )
181
+
182
+ assert .EqualValues (t , "minio" , storage .Type )
183
+ }
184
+
185
+ func Test_getStorageInheritNameSectionType (t * testing.T ) {
186
+ iniStr := `
187
+ [storage.attachments]
188
+ STORAGE_TYPE = minio
189
+ `
190
+ Cfg , _ = ini .Load ([]byte (iniStr ))
191
+
192
+ sec := Cfg .Section ("attachment" )
193
+ storageType := sec .Key ("STORAGE_TYPE" ).MustString ("" )
194
+ storage := getStorage ("attachments" , storageType , sec )
195
+
196
+ assert .EqualValues (t , "minio" , storage .Type )
197
+ }
0 commit comments