diff --git a/integrationtest/integrationtest.go b/integrationtest/integrationtest.go
index b06f4801602b46abeea845ee5619529dde0b2dcc..2027c1b0c9ee8be0e4ca66beb4388f9ae643a547 100644
--- a/integrationtest/integrationtest.go
+++ b/integrationtest/integrationtest.go
@@ -204,36 +204,41 @@ func makeQuery(uri string) error {
 	return nil
 }
 
-func main() {
-	flag.Parse()
-
+func runIntegrationTest(profile bool) error {
 	dir, err := os.MkdirTemp("", "")
 	if err != nil {
-		log.Fatal(err)
+		return err
 	}
 	defer os.RemoveAll(dir)
 
+	// When loading the database with test data, lower the max
+	// file size so as to ensure a few finalized Parquet files are
+	// created and we can query them right away.
+	writer.MaxRecordsPerFile = 10000
 	log.Printf("generating random records")
-	genRandomRecords(dir, 2*writer.MaxRecordsPerFile)
+	genRandomRecords(dir, 10*writer.MaxRecordsPerFile)
 
 	log.Printf("starting benchmark")
-	err = runBench(func(uri string) error {
-
-		f, err := os.Create(*cpuprofile)
-		if err != nil {
-			log.Fatal(err)
+	return runBench(func(uri string) error {
+		if profile {
+			f, err := os.Create(*cpuprofile)
+			if err != nil {
+				return err
+			}
+			pprof.StartCPUProfile(f)
 		}
-		pprof.StartCPUProfile(f)
 
 		if err := loadDir(uri, dir); err != nil {
 			return err
 		}
 
-		// Stop collecting profiles.
-		pprof.StopCPUProfile()
-		runtime.GC()
-		dumpMemProfile("heap", *heapprofile)
-		dumpMemProfile("allocs", *allocprofile)
+		if profile {
+			// Stop collecting profiles.
+			pprof.StopCPUProfile()
+			runtime.GC()
+			dumpMemProfile("heap", *heapprofile)
+			dumpMemProfile("allocs", *allocprofile)
+		}
 
 		// Run validation query.
 		if err := makeQuery(uri); err != nil {
@@ -243,9 +248,6 @@ func main() {
 
 		return nil
 	})
-	if err != nil {
-		log.Fatal(err)
-	}
 }
 
 func dumpMemProfile(kind, filename string) {
@@ -256,3 +258,11 @@ func dumpMemProfile(kind, filename string) {
 	defer f.Close()
 	pprof.Lookup(kind).WriteTo(f, 0)
 }
+
+func main() {
+	flag.Parse()
+
+	if err := runIntegrationTest(true); err != nil {
+		log.Fatal(err)
+	}
+}
diff --git a/integrationtest/integrationtest_test.go b/integrationtest/integrationtest_test.go
new file mode 100644
index 0000000000000000000000000000000000000000..350154638878366dce439a22abacecf13dfb72ac
--- /dev/null
+++ b/integrationtest/integrationtest_test.go
@@ -0,0 +1,11 @@
+package main
+
+import (
+	"testing"
+)
+
+func TestIntegration(t *testing.T) {
+	if err := runIntegrationTest(false); err != nil {
+		t.Fatal(err)
+	}
+}