clean up messy initial comit, remove last traces of working project name, and add resilience to db test.

This commit is contained in:
2020-04-14 15:17:34 +02:00
parent 4cce632708
commit 6837e7b4c8
14 changed files with 20 additions and 5126 deletions
+2
View File
@@ -0,0 +1,2 @@
/.idea
/graph/graphcore/*
-8
View File
@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
-5
View File
@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="xiaoli@localhost" uuid="58ed4679-da13-4e36-bc48-70b2cb7bb1fe">
<driver-ref>mariadb</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://localhost:3306/xiaoli</jdbc-url>
</data-source>
</component>
</project>
-13
View File
@@ -1,13 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="gisle">
<words>
<w>blargh</w>
<w>blendings</w>
<w>graphcore</w>
<w>qpos</w>
<w>sourcream</w>
<w>stufflog</w>
<w>xiaoli</w>
</words>
</dictionary>
</component>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/xiaoli.iml" filepath="$PROJECT_DIR$/.idea/xiaoli.iml" />
</modules>
</component>
</project>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/migrations/mysql/20200405173553_create_table_project.sql" dialect="GenericSQL" />
<file url="PROJECT" dialect="MariaDB" />
</component>
</project>
-29
View File
@@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions">
<TaskOptions isEnabled="true">
<option name="arguments" value="fmt $FilePath$" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="go" />
<option name="immediateSync" value="false" />
<option name="name" value="go fmt" />
<option name="output" value="$FilePath$" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="program" value="$GoExecPath$" />
<option name="runOnExternalChanges" value="false" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$ProjectFileDir$" />
<envs>
<env name="GOROOT" value="$GOROOT$" />
<env name="GOPATH" value="$GOPATH$" />
<env name="PATH" value="$GoBinDirs$" />
</envs>
</TaskOptions>
</component>
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+16 -8
View File
@@ -13,17 +13,26 @@ var testDB *DB
func TestMain(m *testing.M) { func TestMain(m *testing.M) {
testDbConnect := os.Getenv("DB_TEST_CONNECT") testDbConnect := os.Getenv("DB_TEST_CONNECT")
if testDbConnect == "" { if testDbConnect == "" {
testDbConnect = "xiaoli_test:test1234@(localhost:3306)/xiaoli_test" testDbConnect = "stufflog_test:test1234@(localhost:3306)/stufflog_test"
} }
db, err := Open(testDbConnect) for i := 0; i < 10; i++ {
if err != nil { db, err := Open(testDbConnect)
log.Println("DB ERROR", err) if err != nil {
log.Println("DB ERROR", err)
time.Sleep(time.Second)
continue
}
testDB = db
}
if testDB == nil {
log.Println("DB FAILED")
os.Exit(1) os.Exit(1)
return return
} }
err = goose.SetDialect("mysql") err := goose.SetDialect("mysql")
if err != nil { if err != nil {
log.Println("GOOSE ERROR", err) log.Println("GOOSE ERROR", err)
os.Exit(1) os.Exit(1)
@@ -31,20 +40,19 @@ func TestMain(m *testing.M) {
} }
for { for {
err = goose.Down(db.db.DB, "../../../migrations/mysql") err = goose.Down(testDB.db.DB, "../../../migrations/mysql")
if err != nil { if err != nil {
break break
} }
} }
err = goose.Up(db.db.DB, "../../../migrations/mysql") err = goose.Up(testDB.db.DB, "../../../migrations/mysql")
if err != nil && err != goose.ErrNoNextVersion && err != goose.ErrNoCurrentVersion { if err != nil && err != goose.ErrNoNextVersion && err != goose.ErrNoCurrentVersion {
log.Println("UP ERROR", err) log.Println("UP ERROR", err)
os.Exit(3) os.Exit(3)
return return
} }
testDB = db
code := m.Run() code := m.Run()
os.Exit(code) os.Exit(code)
File diff suppressed because it is too large Load Diff
-38
View File
@@ -1,38 +0,0 @@
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package graphcore
import (
"git.aiterp.net/stufflog/server/models"
)
// A limited filter for constraining the list of issues within a project.
type ProjectIssueFilter struct {
// Filter by assignee IDs
AssigneeIds []string `json:"assigneeIds"`
// Text search
Search *string `json:"search"`
// Earliest stage (inclusive)
MinStage *int `json:"minStage"`
// Latest stage (inclusive)
MaxStage *int `json:"maxStage"`
// Limit the result set
Limit *int `json:"limit"`
}
// The permissions of a user within the project.
type ProjectPermissions struct {
// User ID.
UserID string `json:"userId"`
// Access level.
AccessLevel int `json:"accessLevel"`
// The user whose permissions it is. Can be null if the user no longer exists.
User *models.User `json:"user"`
}
// Input for loginUser.
type UserLoginInput struct {
UserID string `json:"userId"`
Password string `json:"password"`
RememberMe bool `json:"rememberMe"`
}
+2 -2
View File
@@ -12,7 +12,7 @@ import (
func main() { func main() {
app := &cli.App{ app := &cli.App{
Name: "xiaoli", Name: "stufflog",
Usage: "Issue tracker for your home and hobbies", Usage: "Issue tracker for your home and hobbies",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
@@ -23,7 +23,7 @@ func main() {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "db-connect", Name: "db-connect",
Value: "xiaoli_user:stuff1234@(localhost:3306)/xiaoli", Value: "stufflog_user:stuff1234@(localhost:3306)/stufflog",
Usage: "Database connection string or path", Usage: "Database connection string or path",
EnvVars: []string{"DATABASE_CONNECT"}, EnvVars: []string{"DATABASE_CONNECT"},
}, },