github.com/StarfishStorage/goofys@v0.23.2-0.20200415030923-535558486b34/internal/minio_test.go (about)

     1  // Copyright 2016 Ka-Hing Cheung
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package internal
    16  
    17  import (
    18  	. "github.com/kahing/goofys/api/common"
    19  	. "gopkg.in/check.v1"
    20  
    21  	"context"
    22  
    23  	"github.com/aws/aws-sdk-go/service/s3"
    24  )
    25  
    26  type MinioTest struct {
    27  	fs    *Goofys
    28  	flags FlagStorage
    29  	s3    *S3Backend
    30  }
    31  
    32  var _ = Suite(&MinioTest{})
    33  
    34  func (s *MinioTest) SetUpSuite(t *C) {
    35  	s.fs = &Goofys{}
    36  
    37  	conf := (&S3Config{
    38  		AccessKey: "Q3AM3UQ867SPQQA43P2F",
    39  		SecretKey: "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG",
    40  	}).Init()
    41  	s.flags = FlagStorage{
    42  		Endpoint: "https://play.minio.io:9000",
    43  		Backend:  conf,
    44  	}
    45  
    46  	var err error
    47  	s.s3, err = NewS3("", &s.flags, conf)
    48  	t.Assert(err, IsNil)
    49  
    50  	_, err = s.s3.ListBuckets(nil)
    51  	t.Assert(err, IsNil)
    52  }
    53  
    54  func (s *MinioTest) SetUpTest(t *C) {
    55  	bucket := RandStringBytesMaskImprSrc(32)
    56  
    57  	_, err := s.s3.CreateBucket(&s3.CreateBucketInput{
    58  		Bucket: &bucket,
    59  	})
    60  	t.Assert(err, IsNil)
    61  
    62  	s.fs = NewGoofys(context.Background(), bucket, &s.flags)
    63  	t.Assert(s.fs, NotNil)
    64  }
    65  
    66  func (s *MinioTest) TestMinioNoop(t *C) {
    67  }