2019-02-19 23:56:41 +00:00
|
|
|
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
|
|
|
// Use of this source code is governed by the Drone Non-Commercial License
|
|
|
|
// that can be found in the LICENSE file.
|
|
|
|
|
2019-02-28 07:07:13 +00:00
|
|
|
// +build !oss
|
|
|
|
|
2019-02-19 23:56:41 +00:00
|
|
|
package logs
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestKey(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
bucket string
|
|
|
|
prefix string
|
|
|
|
result string
|
|
|
|
}{
|
|
|
|
{
|
|
|
|
bucket: "test-bucket",
|
|
|
|
prefix: "drone/logs",
|
|
|
|
result: "/drone/logs/1",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
bucket: "test-bucket",
|
|
|
|
prefix: "/drone/logs",
|
|
|
|
result: "/drone/logs/1",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, test := range tests {
|
|
|
|
s := &s3store{
|
|
|
|
bucket: test.bucket,
|
|
|
|
prefix: test.prefix,
|
|
|
|
}
|
|
|
|
if got, want := s.key(1), test.result; got != want {
|
|
|
|
t.Errorf("Want key %s, got %s", want, got)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|