-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only run database startup when running server (#1012)
An error was discovered where database startup, including database migrations and failed operation recovery was being run for every command that accessed the database, including "tf dump". This had the effect of marking any in-progress operations as failed, even if they were still really in progress. This has been a problem since the introduction of in-progress operation recovery in v1.1.0 (commit c845267). [#187500102](https://www.pivotaltracker.com/story/show/187500102)
- Loading branch information
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package dbservice_test | ||
package dbservice | ||
|
||
import ( | ||
"testing" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package integrationtest_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"time" | ||
|
||
. "github.com/onsi/gomega/gbytes" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
. "github.com/onsi/gomega/gexec" | ||
) | ||
|
||
var _ = Describe("TF Dump", func() { | ||
It("does not run database migration", func() { | ||
cmd := exec.Command(csb, "tf", "dump", "tf:fake-id:") | ||
cmd.Env = append( | ||
os.Environ(), | ||
"DB_TYPE=sqlite3", | ||
fmt.Sprintf("DB_PATH=%s", database), | ||
) | ||
session, err := Start(cmd, GinkgoWriter, GinkgoWriter) | ||
Expect(err).NotTo(HaveOccurred()) | ||
Eventually(session).WithTimeout(time.Minute).Should(Exit(2)) | ||
Expect(session.Err).To(Say("panic: no such table: password_metadata")) | ||
}) | ||
}) |