Exemple #1
0
func (s *GoofysTest) setupMinio(t *C, addr string) (accessKey string, secretKey string) {
	accessKeyID, perr := auth.GenerateAccessKeyID()
	t.Assert(perr, IsNil)
	secretAccessKey, perr := auth.GenerateSecretAccessKey()
	t.Assert(perr, IsNil)

	accessKey = string(accessKeyID)
	secretKey = string(secretAccessKey)

	authConf := &auth.Config{}
	authConf.Users = make(map[string]*auth.User)
	authConf.Users[string(accessKeyID)] = &auth.User{
		Name:            "testuser",
		AccessKeyID:     accessKey,
		SecretAccessKey: secretKey,
	}
	auth.SetAuthConfigPath(filepath.Join(t.MkDir(), "users.json"))
	perr = auth.SaveConfig(authConf)
	t.Assert(perr, IsNil)

	go server.Start(api.Config{Address: addr})

	err := s.waitFor(t, addr)
	t.Assert(err, IsNil)

	return
}
func (s *ControllerRPCSuite) SetUpSuite(c *C) {
	root, err := ioutil.TempDir(os.TempDir(), "api-")
	c.Assert(err, IsNil)
	s.root = root
	auth.SetAuthConfigPath(root)

	testControllerRPC = httptest.NewServer(getControllerRPCHandler())
	testServerRPC = httptest.NewUnstartedServer(getServerRPCHandler())
	testServerRPC.Config.Addr = ":9002"
	testServerRPC.Start()

	url, gerr := url.Parse(testServerRPC.URL)
	c.Assert(gerr, IsNil)
	s.url = url
}
func (s *MyAPISignatureV4Suite) SetUpSuite(c *C) {
	root, err := ioutil.TempDir(os.TempDir(), "api-")
	c.Assert(err, IsNil)
	s.root = root

	conf := &donut.Config{}
	conf.Version = "0.0.1"
	conf.DonutName = "test"
	conf.NodeDiskMap = createTestNodeDiskMap(root)
	conf.MaxSize = 100000
	donut.SetDonutConfigPath(filepath.Join(root, "donut.json"))
	perr := donut.SaveConfig(conf)
	c.Assert(perr, IsNil)

	accessKeyID, perr := auth.GenerateAccessKeyID()
	c.Assert(perr, IsNil)
	secretAccessKey, perr := auth.GenerateSecretAccessKey()
	c.Assert(perr, IsNil)

	authConf := &auth.Config{}
	authConf.Users = make(map[string]*auth.User)
	authConf.Users[string(accessKeyID)] = &auth.User{
		Name:            "testuser",
		AccessKeyID:     string(accessKeyID),
		SecretAccessKey: string(secretAccessKey),
	}
	s.accessKeyID = string(accessKeyID)
	s.secretAccessKey = string(secretAccessKey)

	auth.SetAuthConfigPath(root)
	perr = auth.SaveConfig(authConf)
	c.Assert(perr, IsNil)

	minioAPI := getNewAPI()
	httpHandler := getAPIHandler(minioAPI)
	go startTM(minioAPI)
	testSignatureV4Server = httptest.NewServer(httpHandler)
}