[fix] cleanup test data

This commit is contained in:
Anton Nesterov 2024-08-15 13:41:27 +02:00
parent 7457d8ac81
commit de9d8ad231
No known key found for this signature in database
GPG key ID: 59121E8AE2851FB5
2 changed files with 14 additions and 0 deletions

View file

@ -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.