Further fixes -

- All test files have been renamed to their respective <package>_test name,
    this is done in accordance with
      - https://github.com/golang/go/wiki/CodeReviewComments#import-dot
        imports are largely used in testing, but to avoid namespace collision
        and circular dependencies

  - Never use _* in package names other than "_test" change fragment_v1 to expose
    fragment just like 'gopkg.in/check.v1'
This commit is contained in:
Harshavardhana
2015-03-06 01:50:51 -08:00
parent 02ccf123c9
commit e5af8a3f5d
24 changed files with 245 additions and 285 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package config
package config_test
import (
"io/ioutil"
@@ -23,6 +23,7 @@ import (
"sync"
"testing"
"github.com/minio-io/minio/pkg/utils/config"
"github.com/minio-io/minio/pkg/utils/crypto/keys"
. "gopkg.in/check.v1"
)
@@ -34,22 +35,22 @@ var _ = Suite(&MySuite{})
func Test(t *testing.T) { TestingT(t) }
func (s *MySuite) TestConfig(c *C) {
conf := Config{}
conf.configPath, _ = ioutil.TempDir("/tmp", "minio-test-")
defer os.RemoveAll(conf.configPath)
conf.configFile = path.Join(conf.configPath, "config.json")
if _, err := os.Stat(conf.configFile); os.IsNotExist(err) {
_, err = os.Create(conf.configFile)
conf := config.Config{}
conf.ConfigPath, _ = ioutil.TempDir("/tmp", "minio-test-")
defer os.RemoveAll(conf.ConfigPath)
conf.ConfigFile = path.Join(conf.ConfigPath, "config.json")
if _, err := os.Stat(conf.ConfigFile); os.IsNotExist(err) {
_, err = os.Create(conf.ConfigFile)
if err != nil {
c.Fatal(err)
}
}
conf.configLock = new(sync.RWMutex)
conf.ConfigLock = new(sync.RWMutex)
accesskey, _ := keys.GenerateRandomAlphaNumeric(keys.MinioAccessID)
secretkey, _ := keys.GenerateRandomBase64(keys.MinioSecretID)
user := User{
user := config.User{
Name: "gnubot",
AccessKey: string(accesskey),
SecretKey: string(secretkey),
@@ -64,7 +65,7 @@ func (s *MySuite) TestConfig(c *C) {
accesskey, _ = keys.GenerateRandomAlphaNumeric(keys.MinioAccessID)
secretkey, _ = keys.GenerateRandomBase64(keys.MinioSecretID)
user = User{
user = config.User{
Name: "minio",
AccessKey: string(accesskey),
SecretKey: string(secretkey),