Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade v1.12.7 #252

Merged
merged 16 commits into from
Jul 28, 2023
Prev Previous commit
Next Next commit
Upgrade v1.12.3 (#202)
* Fix the problem of package facades path

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Upgrade v1.12.3

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action

* Optimize action
  • Loading branch information
hwbrzzl authored Jun 22, 2023
commit f7260a71f3194d85242b6fe3ee304640126e27d4
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ jobs:
run: go mod tidy
- name: Run tests
run: go test ./...
windows:
strategy:
matrix:
go: [ '1.20', '1.19', '1.18' ]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Install dependencies
run: go mod tidy
- name: Run tests
run: go test ./... -short
2 changes: 1 addition & 1 deletion auth/console/policy_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func TestEventMakeCommand(t *testing.T) {
assert.True(t, file.Contain("app/policies/User/auth_policy.go", "package User"))
assert.True(t, file.Contain("app/policies/User/auth_policy.go", "type AuthPolicy struct {"))

assert.True(t, file.Remove("app"))
assert.Nil(t, file.Remove("app"))
}
2 changes: 1 addition & 1 deletion config/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestApplicationTestSuite(t *testing.T) {
config: NewApplication(".env"),
})

file.Remove(".env")
assert.Nil(t, file.Remove(".env"))
}

func (s *ApplicationTestSuite) SetupTest() {
Expand Down
2 changes: 1 addition & 1 deletion console/console/key_generate_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestKeyGenerateCommand(t *testing.T) {
env, err = os.ReadFile(".env")
assert.Nil(t, err)
assert.True(t, len(env) > 10)
assert.True(t, file.Remove(".env"))
assert.Nil(t, file.Remove(".env"))

mockConfig.AssertExpectations(t)
}
2 changes: 1 addition & 1 deletion console/console/make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ func TestMakeCommand(t *testing.T) {
assert.True(t, file.Contain("app/console/commands/Goravel/clean_cache.go", "package Goravel"))
assert.True(t, file.Contain("app/console/commands/Goravel/clean_cache.go", "type CleanCache struct"))

assert.True(t, file.Remove("app"))
assert.Nil(t, file.Remove("app"))
}
8 changes: 6 additions & 2 deletions database/console/migrate_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ type Agent struct {
}

func TestMigrateCommand(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

var (
mockConfig *configmock.Config
pool *dockertest.Pool
Expand Down Expand Up @@ -169,6 +173,6 @@ INSERT INTO agents (name, created_at, updated_at) VALUES ('goravel', '2023-03-11
}

func removeMigrations() {
file.Remove("database")
file.Remove("goravel")
_ = file.Remove("database")
_ = file.Remove("goravel")
}
2 changes: 1 addition & 1 deletion database/console/migrate_creator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestCreate(t *testing.T) {
assert.Nil(t, migrateCreator.Create("create_users_table", "users", true))
assert.True(t, file.Exists(fmt.Sprintf("database/migrations/%s_%s.%s.sql", now.ToShortDateTimeString(), "create_users_table", "up")))
assert.True(t, file.Exists(fmt.Sprintf("database/migrations/%s_%s.%s.sql", now.ToShortDateTimeString(), "create_users_table", "down")))
assert.True(t, file.Remove("database"))
assert.Nil(t, file.Remove("database"))
carbon.UnsetTestNow()

mockConfig.AssertExpectations(t)
Expand Down
4 changes: 4 additions & 0 deletions database/console/migrate_fresh_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
)

func TestMigrateFreshCommand(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

var (
mockConfig *configmock.Config
pool *dockertest.Pool
Expand Down
2 changes: 1 addition & 1 deletion database/console/migrate_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestMigrateMakeCommand(t *testing.T) {
assert.Nil(t, migrateMakeCommand.Handle(mockContext))
assert.True(t, file.Exists(up))
assert.True(t, file.Exists(down))
assert.True(t, file.Remove("database"))
assert.Nil(t, file.Remove("database"))

mockConfig.AssertExpectations(t)
}
4 changes: 4 additions & 0 deletions database/console/migrate_refresh_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
)

func TestMigrateRefreshCommand(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

var (
mockConfig *configmock.Config
pool *dockertest.Pool
Expand Down
4 changes: 4 additions & 0 deletions database/console/migrate_reset_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
)

func TestMigrateResetCommand(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

var (
mockConfig *configmock.Config
pool *dockertest.Pool
Expand Down
4 changes: 4 additions & 0 deletions database/console/migrate_rollback_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
)

func TestMigrateRollbackCommand(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

var (
mockConfig *configmock.Config
pool *dockertest.Pool
Expand Down
4 changes: 4 additions & 0 deletions database/console/migrate_status_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (
)

func TestMigrateStatusCommand(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

var (
mockConfig *configmock.Config
pool *dockertest.Pool
Expand Down
2 changes: 1 addition & 1 deletion database/console/model_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestModelMakeCommand(t *testing.T) {
assert.True(t, file.Contain("app/models/User/phone.go", "package User"))
assert.True(t, file.Contain("app/models/User/phone.go", "type Phone struct"))

assert.True(t, file.Remove("app"))
assert.Nil(t, file.Remove("app"))

mockContext.AssertExpectations(t)
}
2 changes: 1 addition & 1 deletion database/console/observer_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestObserverMakeCommand(t *testing.T) {
assert.True(t, file.Contain("app/observers/User/phone_observer.go", "package User"))
assert.True(t, file.Contain("app/observers/User/phone_observer.go", "type PhoneObserver struct"))

assert.True(t, file.Remove("app"))
assert.Nil(t, file.Remove("app"))

mockContext.AssertExpectations(t)
}
20 changes: 16 additions & 4 deletions database/gorm/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ type QueryTestSuite struct {
}

func TestQueryTestSuite(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

testContext = context.Background()
testContext = context.WithValue(testContext, testContextKey, "goravel")

Expand Down Expand Up @@ -336,7 +340,7 @@ func TestQueryTestSuite(t *testing.T) {
},
})

file.Remove(dbDatabase)
assert.Nil(t, file.Remove(dbDatabase))
assert.Nil(t, mysqlPool.Purge(mysqlResource))
assert.Nil(t, postgresqlPool.Purge(postgresqlResource))
assert.Nil(t, sqlserverPool.Purge(sqlserverResource))
Expand Down Expand Up @@ -2755,6 +2759,10 @@ func (s *QueryTestSuite) TestDBRaw() {
}

func TestReadWriteSeparate(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

readMysqlDocker := NewMysqlDocker()
readMysqlPool, readMysqlResource, readMysqlQuery, err := readMysqlDocker.New()
if err != nil {
Expand Down Expand Up @@ -2869,8 +2877,8 @@ func TestReadWriteSeparate(t *testing.T) {
})
}

file.Remove(dbDatabase)
file.Remove(dbDatabase1)
assert.Nil(t, file.Remove(dbDatabase))
assert.Nil(t, file.Remove(dbDatabase1))

if err := readMysqlPool.Purge(readMysqlResource); err != nil {
log.Fatalf("Could not purge resource: %s", err)
Expand All @@ -2893,6 +2901,10 @@ func TestReadWriteSeparate(t *testing.T) {
}

func TestTablePrefixAndSingular(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

mysqlDocker := NewMysqlDocker()
mysqlPool, mysqlResource, err := mysqlDocker.Init()
if err != nil {
Expand Down Expand Up @@ -2956,7 +2968,7 @@ func TestTablePrefixAndSingular(t *testing.T) {
})
}

file.Remove(dbDatabase)
assert.Nil(t, file.Remove(dbDatabase))

if err := mysqlPool.Purge(mysqlResource); err != nil {
log.Fatalf("Could not purge resource: %s", err)
Expand Down
19 changes: 17 additions & 2 deletions database/gorm/test_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
)

func TestMysqlDocker(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

docker := NewMysqlDocker()
pool, resource, query, err := docker.New()

Expand All @@ -19,6 +23,10 @@ func TestMysqlDocker(t *testing.T) {
}

func TestPostgresqlDocker(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

docker := NewPostgresqlDocker()
pool, resource, query, err := docker.New()

Expand All @@ -29,18 +37,25 @@ func TestPostgresqlDocker(t *testing.T) {
}

func TestSqliteDocker(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

docker := NewSqliteDocker(dbDatabase)
pool, resource, db, err := docker.New()

assert.NotNil(t, pool)
assert.NotNil(t, resource)
assert.NotNil(t, db)
assert.Nil(t, err)

file.Remove("goravel")
assert.Nil(t, file.Remove("goravel"))
}

func TestSqlserverDocker(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

docker := NewSqlserverDocker()
pool, resource, db, err := docker.New()

Expand Down
8 changes: 7 additions & 1 deletion database/orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"log"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"

contractsorm "github.com/goravel/framework/contracts/database/orm"
Expand Down Expand Up @@ -41,6 +42,10 @@ var (
)

func TestOrmSuite(t *testing.T) {
if testing.Short() {
t.Skip("Skipping tests of using docker")
}

mysqlDocker := gorm.NewMysqlDocker()
mysqlPool, mysqlResource, mysqlQuery, err := mysqlDocker.New()
if err != nil {
Expand Down Expand Up @@ -71,7 +76,7 @@ func TestOrmSuite(t *testing.T) {

suite.Run(t, new(OrmSuite))

file.Remove("goravel")
assert.Nil(t, file.Remove("goravel"))

if err := mysqlPool.Purge(mysqlResource); err != nil {
log.Fatalf("Could not purge resource: %s", err)
Expand All @@ -82,6 +87,7 @@ func TestOrmSuite(t *testing.T) {
if err := sqlserverPool.Purge(sqlserverResource); err != nil {
log.Fatalf("Could not purge resource: %s", err)
}

}

func (s *OrmSuite) SetupTest() {
Expand Down
3 changes: 1 addition & 2 deletions event/console/event_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ func TestEventMakeCommand(t *testing.T) {
assert.True(t, file.Exists("app/events/Goravel/event.go"))
assert.True(t, file.Contain("app/events/Goravel/event.go", "package Goravel"))
assert.True(t, file.Contain("app/events/Goravel/event.go", "type Event struct {"))

assert.True(t, file.Remove("app"))
assert.Nil(t, file.Remove("app"))
}
3 changes: 1 addition & 2 deletions event/console/listener_make_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ func TestListenerMakeCommand(t *testing.T) {
assert.True(t, file.Exists("app/listeners/Goravel/listen.go"))
assert.True(t, file.Contain("app/listeners/Goravel/listen.go", "package Goravel"))
assert.True(t, file.Contain("app/listeners/Goravel/listen.go", "type Listen struct {"))

assert.True(t, file.Remove("app"))
assert.Nil(t, file.Remove("app"))
}
4 changes: 2 additions & 2 deletions filesystem/application_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ func TestStorage(t *testing.T) {
}

if disk.disk == "local" || disk.disk == "custom" {
file.Remove("./storage")
assert.Nil(t, file.Remove("./storage"))
}
}

file.Remove("test.txt")
assert.Nil(t, file.Remove("test.txt"))
}

func initConfig() *configmocks.Config {
Expand Down
2 changes: 1 addition & 1 deletion filesystem/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type FileTestSuite struct {
func TestFileTestSuite(t *testing.T) {
suite.Run(t, new(FileTestSuite))

file.Remove("test.txt")
assert.Nil(t, file.Remove("test.txt"))
}

func (s *FileTestSuite) SetupTest() {
Expand Down
2 changes: 1 addition & 1 deletion foundation/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (app *Application) setTimezone() {

func setEnv() {
args := os.Args
if strings.HasSuffix(os.Args[0], ".test") {
if strings.HasSuffix(os.Args[0], ".test") || strings.HasSuffix(os.Args[0], ".test.exe") {
support.Env = support.EnvTest
}
if len(args) >= 2 {
Expand Down
Loading