You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: action_test.go
    path of file: ./repos/juju/state
    
    the code of the file until where you have to start completion: // Copyright 2014-2015 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.

package state_test

import (
	"encoding/json"
	"fmt"
	"math/rand"
	"strings"
	"sync"
	"sync/atomic"
	"time"

	"github.com/juju/clock/testclock"
	"github.com/juju/names/v5"
	jc "github.com/juju/testing/checkers"
	jujutxn "github.com/juju/txn/v3"
	gc "gopkg.in/check.v1"

	"github.com/juju/juju/core/actions"
	"github.com/juju/juju/state"
	stateerrors "github.com/juju/juju/state/errors"
	statetesting "github.com/juju/juju/state/testing"
	coretesting "github.com/juju/juju/testing"
	"github.com/juju/juju/testing/factory"
)

type ActionSuite struct {
	ConnSuite
	charm                 *state.Charm
	actionlessCharm       *state.Charm
	application           *state.Application
	actionlessApplication *state.Application
	unit                  *state.Unit
	unit2                 *state.Unit
	charmlessUnit         *state.Unit
	actionlessUnit        *state.Unit
	model    
    
func (s *ActionSuite) TestLastActionFinishCompletesOperationMany(c *gc.C) {
	numActions := 50

	operationID, err := s.Model.EnqueueOperation("a test", numActions)
	c.Assert(err, jc.ErrorIsNil)

	wg := sync.WaitGroup{}
	var actions []state.Action
	for i := 0; i < numActions; i++ {
		anAction, err := s.Model.AddAction(s.unit, operationID, "snapshot", nil, nil, nil)
		c.Assert(err, jc.ErrorIsNil)

		anAction, err = anAction.Begin()
		c.Assert(err, jc.ErrorIsNil)
		actions = append(actions, anAction)
		wg.Add(1)
	}

	completeCount := int32(0)
	for i := 0; i < numActions; i++ {
		go func(a int) {
			defer func() {
				atomic.AddInt32(&completeCount, 1)
				wg.Done()
			}()
			time.Sleep(time.Millisecond * time.Duration(rand.Intn(5)))
			if atomic.LoadInt32(&completeCount) < int32(numActions) {
				operation, err := s.model.Operation(operationID)
				c.Assert(err, jc.ErrorIsNil)
				c.Assert(operation.Status(), gc.Not(gc.Equals), state.ActionCompleted)
			}

			_, err := actions[a].Finish(state.ActionResults{
				Status: state.ActionCompleted,
			})
			c.Assert(err, jc.ErrorIsNil)
		}(i)
	}
	wg.Wait()

	operation, err := s.model.Operation(operationID)
	c.Assert(err, jc.ErrorIsNil)
	c.Assert(operation.Status(), gc.Equals, state.ActionCompleted)
}