aboutsummaryrefslogtreecommitdiffstats
path: root/it
Commit message (Expand)AuthorAgeFilesLines
* SONAR-7228 Create new "My Issues" page5.4-M10Stas Vilchik2016-01-282-0/+58
* SONAR-7231 improve rendering of password formStas Vilchik2016-01-281-11/+6
* SONAR-7231 Create new "Security" page in "My Space"Stas Vilchik2016-01-283-20/+145
* SONAR-7230 Move user notifications into separate page of "My Account" spaceStas Vilchik2016-01-282-4/+8
* SONAR-7227 Convert "My Profile" page to the new "My Account" pageStas Vilchik2016-01-283-5/+189
* SONAR-6226 Add ITsJulien Lancelot2016-01-2717-4/+795
* SONAR-7122 Update ITs to not use web contextJulien Lancelot2016-01-26114-364/+329
* Fix unit testsJulien Lancelot2016-01-261-20/+27
* Fix /api/authentication/validateJulien Lancelot2016-01-251-0/+21
* SONAR-6226 Create IdentityProvider APIJulien Lancelot2016-01-251-5/+2
* SONAR-7134 WS api/measures/componentTeryk Bellahsene2016-01-201-0/+16
* SONAR-7210 SONAR-7209 WS user_tokens/* add ITTeryk Bellahsene2016-01-191-2/+13
* fix DifferentialPeriodsTest instabilitySébastien Lesaint2016-01-181-4/+5
* SONAR-7168 add user login to log message when restart is requestedSébastien Lesaint2016-01-181-1/+1
* SONAR-7168 add system().restart() to WsClientSébastien Lesaint2016-01-182-4/+14
* Disable unstable testDuarte Meneses2016-01-141-0/+3
* Fix project title in copyright headersSimon Brandhof2016-01-13180-180/+180
* SONAR-7135 WS api/measures/component_tree fix permissions and ITTeryk Bellahsene2016-01-131-1/+2
* SONAR-7135 WS api/measures/component_tree navigate through components and dis...Teryk Bellahsene2016-01-131-0/+82
* SONAR-7168 support restart in prod mode in ITsSébastien Lesaint2016-01-132-11/+23
* SONAR-7174 Add IT to check Execute Analysis perm on projectJulien Lancelot2016-01-122-18/+36
* SONAR-7149 fix ITsStas Vilchik2016-01-071-10/+0
* SONAR-7177 expand the root directoryStas Vilchik2016-01-076-0/+84
* Automatic merge from branch-5.3Jenkins CI2016-01-063-11/+111
|\
| * SONAR-7093 Allow projects to define their leak periodJulien Lancelot2016-01-063-11/+111
* | Upgrade to parent 26 and new copyright headersSimon Brandhof2016-01-05179-409/+2068
* | SONAR-7131 WS components/show show one component and its ancestorsTeryk Bellahsene2016-01-053-3/+75
* | move ProjectOverviewTest under projectServicesStas Vilchik2015-12-286-6/+6
* | add ITs for Project Code PageStas Vilchik2015-12-283-0/+122
* | SONAR-2867 Standard copy-paste detection should happen within a project, not ...Duarte Meneses2015-12-2110-0/+262
* | Speed-up Firefox in Selenium testsSimon Brandhof2015-12-181-1/+11
* | Revert "Use SeleneseTest to improve reliability of selenium"Simon Brandhof2015-12-184-10/+9
* | Use SeleneseTest to improve reliability of seleniumSimon Brandhof2015-12-184-9/+10
* | Automatic merge from branch-5.3Jenkins CI2015-12-112-2/+3
|\|
| * SONAR-6905 Batch should dump analysis-related URL into a properties fileDuarte Meneses2015-12-101-1/+2
| * Reactivate devcockpit in PluginsTestJulien Lancelot2015-12-101-1/+1
* | Automatic merge from branch-5.3Jenkins CI2015-12-097-6/+207
|\|
| * hide number of failing tasks on then project level pageStas Vilchik2015-12-093-0/+132
| * SONAR-6900 Add IT to simulate a build breaker strategyTeryk Bellahsene2015-12-091-3/+72
| * normalize overview pages urls and titlesStas Vilchik2015-12-093-3/+3
* | Upgrade version to 5.4-SNAPSHOTEric Hartmann2015-12-0919-19/+19
|/
* Fix IT of commit #d28a121fe58d6155048ba244e92a36540cba9990Simon Brandhof2015-12-072-2/+2
* SONAR-7098 Add ITJulien Lancelot2015-12-071-0/+37
* Add ITs for auto assign featureJulien Lancelot2015-12-075-0/+110
* SONAR-6939 ability for plugins to override the decimal scale of floatSimon Brandhof2015-12-077-2/+162
* SONAR-6905 replace analysis-details.json by report-task.txtsimonbrandhof2015-12-043-29/+82
* Merge pull request #665 from SonarSource/feature/drop-dashboardsStas Vilchik2015-12-043-67/+4
|\
| * fix ITsStas Vilchik2015-12-023-67/+4
* | fix ProjectOverviewTestStas Vilchik2015-12-033-12/+12
* | SONAR-7028 Update default value of sonar.technicalDebt.ratingGridJulien Lancelot2015-12-035-40/+136
xorm.Session) { if !sess.IsCommitedOrRollbacked { sess.Rollback() } sess.Close() } var ( x *xorm.Engine tables []interface{} // HasEngine specifies if we have a xorm.Engine HasEngine bool // DbCfg holds the database settings DbCfg struct { Type, Host, Name, User, Passwd, Path, SSLMode string } // EnableSQLite3 use SQLite3 EnableSQLite3 bool // EnableTiDB enable TiDB EnableTiDB bool ) func init() { tables = append(tables, new(User), new(PublicKey), new(AccessToken), new(Repository), new(DeployKey), new(Collaboration), new(Access), new(Upload), new(Watch), new(Star), new(Follow), new(Action), new(Issue), new(PullRequest), new(Comment), new(Attachment), new(Label), new(IssueLabel), new(Milestone), new(Mirror), new(Release), new(LoginSource), new(Webhook), new(UpdateTask), new(HookTask), new(Team), new(OrgUser), new(TeamUser), new(TeamRepo), new(Notice), new(EmailAddress), new(Notification), new(IssueUser), new(LFSMetaObject), new(TwoFactor), new(RepoUnit), ) gonicNames := []string{"SSL", "UID"} for _, name := range gonicNames { core.LintGonicMapper[name] = true } } // LoadConfigs loads the database settings func LoadConfigs() { sec := setting.Cfg.Section("database") DbCfg.Type = sec.Key("DB_TYPE").String() switch DbCfg.Type { case "sqlite3": setting.UseSQLite3 = true case "mysql": setting.UseMySQL = true case "postgres": setting.UsePostgreSQL = true case "tidb": setting.UseTiDB = true case "mssql": setting.UseMSSQL = true } DbCfg.Host = sec.Key("HOST").String() DbCfg.Name = sec.Key("NAME").String() DbCfg.User = sec.Key("USER").String() if len(DbCfg.Passwd) == 0 { DbCfg.Passwd = sec.Key("PASSWD").String() } DbCfg.SSLMode = sec.Key("SSL_MODE").String() DbCfg.Path = sec.Key("PATH").MustString("data/gitea.db") sec = setting.Cfg.Section("indexer") setting.Indexer.IssuePath = sec.Key("ISSUE_INDEXER_PATH").MustString("indexers/issues.bleve") setting.Indexer.UpdateQueueLength = sec.Key("UPDATE_BUFFER_LEN").MustInt(20) } // parsePostgreSQLHostPort parses given input in various forms defined in // https://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING // and returns proper host and port number. func parsePostgreSQLHostPort(info string) (string, string) { host, port := "127.0.0.1", "5432" if strings.Contains(info, ":") && !strings.HasSuffix(info, "]") { idx := strings.LastIndex(info, ":") host = info[:idx] port = info[idx+1:] } else if len(info) > 0 { host = info } return host, port } func parseMSSQLHostPort(info string) (string, string) { host, port := "127.0.0.1", "1433" if strings.Contains(info, ":") { host = strings.Split(info, ":")[0] port = strings.Split(info, ":")[1] } else if strings.Contains(info, ",") { host = strings.Split(info, ",")[0] port = strings.TrimSpace(strings.Split(info, ",")[1]) } else if len(info) > 0 { host = info } return host, port } func getEngine() (*xorm.Engine, error) { connStr := "" var Param = "?" if strings.Contains(DbCfg.Name, Param) { Param = "&" } switch DbCfg.Type { case "mysql": if DbCfg.Host[0] == '/' { // looks like a unix socket connStr = fmt.Sprintf("%s:%s@unix(%s)/%s%scharset=utf8&parseTime=true", DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param) } else { connStr = fmt.Sprintf("%s:%s@tcp(%s)/%s%scharset=utf8&parseTime=true", DbCfg.User, DbCfg.Passwd, DbCfg.Host, DbCfg.Name, Param) } case "postgres": host, port := parsePostgreSQLHostPort(DbCfg.Host) if host[0] == '/' { // looks like a unix socket connStr = fmt.Sprintf("postgres://%s:%s@:%s/%s%ssslmode=%s&host=%s", url.QueryEscape(DbCfg.User), url.QueryEscape(DbCfg.Passwd), port, DbCfg.Name, Param, DbCfg.SSLMode, host) } else { connStr = fmt.Sprintf("postgres://%s:%s@%s:%s/%s%ssslmode=%s", url.QueryEscape(DbCfg.User), url.QueryEscape(DbCfg.Passwd), host, port, DbCfg.Name, Param, DbCfg.SSLMode) } case "mssql": host, port := parseMSSQLHostPort(DbCfg.Host) connStr = fmt.Sprintf("server=%s; port=%s; database=%s; user id=%s; password=%s;", host, port, DbCfg.Name, DbCfg.User, DbCfg.Passwd) case "sqlite3": if !EnableSQLite3 { return nil, errors.New("this binary version does not build support for SQLite3") } if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil { return nil, fmt.Errorf("Failed to create directories: %v", err) } connStr = "file:" + DbCfg.Path + "?cache=shared&mode=rwc" case "tidb": if !EnableTiDB { return nil, errors.New("this binary version does not build support for TiDB") } if err := os.MkdirAll(path.Dir(DbCfg.Path), os.ModePerm); err != nil { return nil, fmt.Errorf("Failed to create directories: %v", err) } connStr = "goleveldb://" + DbCfg.Path default: return nil, fmt.Errorf("Unknown database type: %s", DbCfg.Type) } return xorm.NewEngine(DbCfg.Type, connStr) } // NewTestEngine sets a new test xorm.Engine func NewTestEngine(x *xorm.Engine) (err error) { x, err = getEngine() if err != nil { return fmt.Errorf("Connect to database: %v", err) } x.SetMapper(core.GonicMapper{}) return x.StoreEngine("InnoDB").Sync2(tables...) } // SetEngine sets the xorm.Engine func SetEngine() (err error) { x, err = getEngine() if err != nil { return fmt.Errorf("Failed to connect to database: %v", err) } x.SetMapper(core.GonicMapper{}) // WARNING: for serv command, MUST remove the output to os.stdout, // so use log file to instead print to stdout. logPath := path.Join(setting.LogRootPath, "xorm.log") if err := os.MkdirAll(path.Dir(logPath), os.ModePerm); err != nil { return fmt.Errorf("Failed to create dir %s: %v", logPath, err) } f, err := os.Create(logPath) if err != nil { return fmt.Errorf("Failed to create xorm.log: %v", err) } x.SetLogger(xorm.NewSimpleLogger(f)) x.ShowSQL(true) return nil } // NewEngine initializes a new xorm.Engine func NewEngine() (err error) { if err = SetEngine(); err != nil { return err } if err = x.Ping(); err != nil { return err } if err = migrations.Migrate(x); err != nil { return fmt.Errorf("migrate: %v", err) } if err = x.StoreEngine("InnoDB").Sync2(tables...); err != nil { return fmt.Errorf("sync database struct error: %v", err) } return nil } // Statistic contains the database statistics type Statistic struct { Counter struct { User, Org, PublicKey, Repo, Watch, Star, Action, Access, Issue, Comment, Oauth, Follow, Mirror, Release, LoginSource, Webhook, Milestone, Label, HookTask, Team, UpdateTask, Attachment int64 } } // GetStatistic returns the database statistics func GetStatistic() (stats Statistic) { stats.Counter.User = CountUsers() stats.Counter.Org = CountOrganizations() stats.Counter.PublicKey, _ = x.Count(new(PublicKey)) stats.Counter.Repo = CountRepositories(true) stats.Counter.Watch, _ = x.Count(new(Watch)) stats.Counter.Star, _ = x.Count(new(Star)) stats.Counter.Action, _ = x.Count(new(Action)) stats.Counter.Access, _ = x.Count(new(Access)) stats.Counter.Issue, _ = x.Count(new(Issue)) stats.Counter.Comment, _ = x.Count(new(Comment)) stats.Counter.Oauth = 0 stats.Counter.Follow, _ = x.Count(new(Follow)) stats.Counter.Mirror, _ = x.Count(new(Mirror)) stats.Counter.Release, _ = x.Count(new(Release)) stats.Counter.LoginSource = CountLoginSources() stats.Counter.Webhook, _ = x.Count(new(Webhook)) stats.Counter.Milestone, _ = x.Count(new(Milestone)) stats.Counter.Label, _ = x.Count(new(Label)) stats.Counter.HookTask, _ = x.Count(new(HookTask)) stats.Counter.Team, _ = x.Count(new(Team)) stats.Counter.UpdateTask, _ = x.Count(new(UpdateTask)) stats.Counter.Attachment, _ = x.Count(new(Attachment)) return } // Ping tests if database is alive func Ping() error { return x.Ping() } // DumpDatabase dumps all data from database according the special database SQL syntax to file system. func DumpDatabase(filePath string, dbType string) error { var tbs []*core.Table for _, t := range tables { tbs = append(tbs, x.TableInfo(t).Table) } if len(dbType) > 0 { return x.DumpTablesToFile(tbs, filePath, core.DbType(dbType)) } return x.DumpTablesToFile(tbs, filePath) }