0
0
mirror of https://github.com/thegeeklab/wp-s3-action.git synced 2024-06-02 18:39:42 +02:00
This commit is contained in:
Robert Kaussow 2024-05-12 10:46:17 +02:00
parent 6f16a196d6
commit 3c96f333c9
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
3 changed files with 8 additions and 8 deletions

View File

@ -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{

View File

@ -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)

View File

@ -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,
}