hunk.code_window: 		"mysql":              3306,
   		"postgres":           5432,
   		"minio":              9000,
   		"inbucket":           10080,
   		"openldap":           389,
   		"elasticsearch":      9200,
   		"dejavu":             1358,
   		"keycloak":           8080,
  
hunk.labels: keep keep keep replace keep keep keep keep
hunk.after_edit: 		"inbucket":           9001,
  
hunk.file_path: build/docker-compose-generator/main.go
hunk.type: replace
file: // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
  // See LICENSE.txt for license information.
  
  package storetest
  
  import (
  	"testing"
  	"time"
  
  	"github.com/stretchr/testify/assert"
  	"github.com/stretchr/testify/require"
  
  	"github.com/mattermost/mattermost-server/v6/model"
  	"github.com/mattermost/mattermost-server/v6/store"
  )
  
  func TestAuditStore(t *testing.T, ss store.Store) {
  	t.Run("", func(t *testing.T) { testAuditStore(t, ss) })
  }
  
  func testAuditStore(t *testing.T, ss store.Store) {
  	audit := &model.Audit{UserId: model.NewId(), IpAddress: "ipaddress", Action: "Action"}
  	require.NoError(t, ss.Audit().Save(audit))
  	time.Sleep(100 * time.Millisecond)
  	require.NoError(t, ss.Audit().Save(audit))
  	time.Sleep(100 * time.Millisecond)
  	require.NoError(t, ss.Audit().Save(audit))
  	time.Sleep(100 * time.Millisecond)
  	audit.ExtraInfo = "extra"
  	time.Sleep(100 * time.Millisecond)
  	require.NoError(t, ss.Audit().Save(audit))
  
  	time.Sleep(100 * time.Millisecond)
  
  	audits, err := ss.Audit().Get(audit.UserId, 0, 100)
  	require.NoError(t, err)
  
  	assert.Len(t, audits, 4)
  
  	assert.Equal(t, "extra", audits[0].ExtraInfo)
  
  	audits, err = ss.Audit().Get("missing", 0, 100)
  	require.NoError(t, err)
  	assert.Empty(t, audits)
  
  	audits, err = ss.Audit().Get("", 0, 100)
  	require.NoError(t, err)
  	require.Len(t, audits, 4, "Failed to save and retrieve 4 audit logs")
  
  	require.NoError(t, ss.Audit().PermanentDeleteByUser(audit.UserId))
  }
  