1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

test: Start work on test suite for #82

- smtp: Tidy up []byte/buffer/string use in delivery #69
This commit is contained in:
James Hillyerd
2018-03-14 22:51:40 -07:00
parent 519779b7ba
commit 5e13e50763
5 changed files with 124 additions and 42 deletions

View File

@@ -121,6 +121,7 @@ func (fs *Store) AddMessage(m storage.StoreMessage) (id string, err error) {
// Update the index.
fm.Fdate = m.Date()
fm.Ffrom = m.From()
fm.Fto = m.To()
fm.Fsize = size
fm.Fsubject = m.Subject()
mb.messages = append(mb.messages, fm)

View File

@@ -16,9 +16,23 @@ import (
"github.com/jhillyerd/inbucket/pkg/config"
"github.com/jhillyerd/inbucket/pkg/message"
"github.com/jhillyerd/inbucket/pkg/storage"
"github.com/jhillyerd/inbucket/pkg/test"
"github.com/stretchr/testify/assert"
)
// TestSuite runs storage package test suite on file store.
func TestSuite(t *testing.T) {
ds, logbuf := setupDataStore(config.DataStoreConfig{})
defer teardownDataStore(ds)
test.StoreSuite(t, ds)
if t.Failed() {
// Wait for handler to finish logging.
time.Sleep(2 * time.Second)
// Dump buffered log data if there was a failure.
_, _ = io.Copy(os.Stderr, logbuf)
}
}
// Test directory structure created by filestore
func TestFSDirStructure(t *testing.T) {
ds, logbuf := setupDataStore(config.DataStoreConfig{})