[fix] cleanup test data
This commit is contained in:
parent
7457d8ac81
commit
de9d8ad231
|
@ -3,6 +3,10 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"l12.xyz/dal/adapter"
|
||||
|
@ -20,6 +24,13 @@ func mock(adapter adapter.DBAdapter) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
defer os.Remove("test.sqlite")
|
||||
c := make(chan os.Signal)
|
||||
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
|
||||
go func() {
|
||||
<-c
|
||||
os.Remove("test.sqlite")
|
||||
}()
|
||||
db := adapter.DBAdapter{
|
||||
Type: "sqlite3",
|
||||
}
|
||||
|
@ -29,4 +40,7 @@ func main() {
|
|||
mux.Handle("/", queryHandler)
|
||||
fmt.Println("Server running on port 8111")
|
||||
http.ListenAndServe(":8111", mux)
|
||||
wg := sync.WaitGroup{}
|
||||
wg.Add(1)
|
||||
wg.Wait()
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue