mirror of
https://github.com/thegeeklab/wp-s3-action.git
synced 2024-06-02 18:39:42 +02:00
cleanup
This commit is contained in:
parent
6f16a196d6
commit
3c96f333c9
|
@ -15,12 +15,12 @@ type Cloudfront struct {
|
|||
Distribution string
|
||||
}
|
||||
|
||||
type CloudfrontInvalidateOpt struct {
|
||||
type CloudfrontInvalidateOptions struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// Invalidate invalidates the specified path in the CloudFront distribution.
|
||||
func (c *Cloudfront) Invalidate(ctx context.Context, opt CloudfrontInvalidateOpt) error {
|
||||
func (c *Cloudfront) Invalidate(ctx context.Context, opt CloudfrontInvalidateOptions) error {
|
||||
log.Debug().Msgf("invalidating '%s'", opt.Path)
|
||||
|
||||
_, err := c.client.CreateInvalidation(ctx, &cloudfront.CreateInvalidationInput{
|
||||
|
|
|
@ -16,12 +16,12 @@ func TestCloudfront_Invalidate(t *testing.T) {
|
|||
|
||||
tests := []struct {
|
||||
name string
|
||||
setup func(t *testing.T) (*Cloudfront, CloudfrontInvalidateOpt, func())
|
||||
setup func(t *testing.T) (*Cloudfront, CloudfrontInvalidateOptions, func())
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "invalidate path successfully",
|
||||
setup: func(t *testing.T) (*Cloudfront, CloudfrontInvalidateOpt, func()) {
|
||||
setup: func(t *testing.T) (*Cloudfront, CloudfrontInvalidateOptions, func()) {
|
||||
t.Helper()
|
||||
|
||||
mockClient := mocks.NewMockCloudfrontAPIClient(t)
|
||||
|
@ -32,7 +32,7 @@ func TestCloudfront_Invalidate(t *testing.T) {
|
|||
return &Cloudfront{
|
||||
client: mockClient,
|
||||
Distribution: "test-distribution",
|
||||
}, CloudfrontInvalidateOpt{
|
||||
}, CloudfrontInvalidateOptions{
|
||||
Path: "/path/to/invalidate",
|
||||
}, func() {
|
||||
mockClient.AssertExpectations(t)
|
||||
|
@ -42,7 +42,7 @@ func TestCloudfront_Invalidate(t *testing.T) {
|
|||
},
|
||||
{
|
||||
name: "error when create invalidation fails",
|
||||
setup: func(t *testing.T) (*Cloudfront, CloudfrontInvalidateOpt, func()) {
|
||||
setup: func(t *testing.T) (*Cloudfront, CloudfrontInvalidateOptions, func()) {
|
||||
t.Helper()
|
||||
|
||||
mockClient := mocks.NewMockCloudfrontAPIClient(t)
|
||||
|
@ -53,7 +53,7 @@ func TestCloudfront_Invalidate(t *testing.T) {
|
|||
return &Cloudfront{
|
||||
client: mockClient,
|
||||
Distribution: "test-distribution",
|
||||
}, CloudfrontInvalidateOpt{
|
||||
}, CloudfrontInvalidateOptions{
|
||||
Path: "/path/to/invalidate",
|
||||
}, func() {
|
||||
mockClient.AssertExpectations(t)
|
||||
|
|
|
@ -207,7 +207,7 @@ func (p *Plugin) runJobs(ctx context.Context, client *aws.Client) error {
|
|||
}
|
||||
|
||||
if invalidateJob != nil {
|
||||
opt := aws.CloudfrontInvalidateOpt{
|
||||
opt := aws.CloudfrontInvalidateOptions{
|
||||
Path: invalidateJob.remote,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user