Testing http routes in go
Using the tips of the justforfunc #16 video, you could make your tests using a table (tt = testing table) and then iterate on it (tc = test case).

Your test could then look like this:

func TestSigHandler(t *testing.T) {
    jsonHeaders := map[string]string{"Content-Type": "application/json"}

    tt := []struct {
        name    string
        method  string
        uri     string
        payload []byte
        headers map[string]string
    }{
        {"get item", "GET", "/1/sig/id/2021205", nil, nil},
        {"post new item", "POST", "/1/sig/id/2021205", []byte(`{"raw": "a new sig"}`), jsonHeaders},
        {"delete item", "DELETE", "/1/sig/id/1000345", nil, nil},
    }

    for _, tc := range tt {
        t.Run(tc.name, func(t *testing.T) {
            var payload io.Reader
            if tc.payload != nil {
                payload = bytes.NewBuffer(tc.payload)
            }
            req, err := http.NewRequest(tc.method, server.URL+tc.uri, payload)
            if err != nil {
                t.Fatalf("could not create request: %v", err)
            }

            for key, value := range tc.headers {
                req.Header.Set(key, value)
            }

            res, err := http.DefaultClient.Do(req)
            if err != nil {
                t.Fatalf("could not send request: %v", err)
            }

            if res.StatusCode != http.StatusOK {
                t.Fatalf("expected status OK; got %v", res.Status)
            }
        })
    }
}


Looking at your TestMain, I have the feeling that you are doing only integration tests (from the request to the database).

You should split you tests to the individual layers (the current one if for routing: it could use a mocked DB).

With this approach, the TestMain could be deleted (do only the setup that is necessary for each test).