Refactor parts of the code and add more tests

This is a refactor of parts of the code, some minor things such as adding
punctuation in the end of sentences and making the code a bit easier to read.

More tests has been added in the form of gometalinter which checks the code
health, style and spelling errors. The flaky cleanup test should also be fixed
with this commit.
This commit is contained in:
Anton Lindstrom
2016-07-21 19:48:29 +00:00
parent 3d07ee7804
commit d42994de5c
6 changed files with 83 additions and 56 deletions

View File

@@ -27,14 +27,14 @@ func (ho headerOnlyResponseWriter) WriteHeader(int) {
var secret = "EyaC2BPcJtNqU3tjEHy+c+Wmqc1yihYIbUWEl/jk0Ga73kWBclmuSFd9HuJKwJw/Wdsh1XnjY2Bw1HBVph6WOw=="
func TestPGStore(t *testing.T) {
ss, err := NewPGStore(os.Getenv("PGSTORE_TEST_CONN"), []byte(secret))
if err != nil {
t.Fatal("failed to get store", err.Error())
dsn := os.Getenv("PGSTORE_TEST_CONN")
if dsn == "" {
t.Skip("This test requires a real database.")
}
if ss == nil {
t.Skip("This test requires a real database")
ss, err := NewPGStore(dsn, []byte(secret))
if err != nil {
t.Fatal("Failed to get store", err)
}
defer ss.Close()
@@ -125,14 +125,14 @@ func TestPGStore(t *testing.T) {
}
func TestSessionOptionsAreUniquePerSession(t *testing.T) {
ss, err := NewPGStore(os.Getenv("PGSTORE_TEST_CONN"), []byte(secret))
if err != nil {
t.Fatal("Failed to get store", err)
dsn := os.Getenv("PGSTORE_TEST_CONN")
if dsn == "" {
t.Skip("This test requires a real database.")
}
if ss == nil {
t.Skip("This test requires a real database")
ss, err := NewPGStore(dsn, []byte(secret))
if err != nil {
t.Fatal("Failed to get store", err)
}
defer ss.Close()