mock_test.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2020 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package gitutil
  5. import (
  6. "testing"
  7. "github.com/gogs/git-module"
  8. )
  9. var _ ModuleStore = (*MockModuleStore)(nil)
  10. // MockModuleStore is a mock implementation of ModuleStore interface.
  11. type MockModuleStore struct {
  12. repoAddRemote func(repoPath, name, url string, opts ...git.AddRemoteOptions) error
  13. repoDiffNameOnly func(repoPath, base, head string, opts ...git.DiffNameOnlyOptions) ([]string, error)
  14. repoLog func(repoPath, rev string, opts ...git.LogOptions) ([]*git.Commit, error)
  15. repoMergeBase func(repoPath, base, head string, opts ...git.MergeBaseOptions) (string, error)
  16. repoRemoveRemote func(repoPath, name string, opts ...git.RemoveRemoteOptions) error
  17. repoTags func(repoPath string, opts ...git.TagsOptions) ([]string, error)
  18. pullRequestMeta func(headPath, basePath, headBranch, baseBranch string) (*PullRequestMeta, error)
  19. listTagsAfter func(repoPath, after string, limit int) (*TagsPage, error)
  20. }
  21. func (m *MockModuleStore) RepoAddRemote(repoPath, name, url string, opts ...git.AddRemoteOptions) error {
  22. return m.repoAddRemote(repoPath, name, url, opts...)
  23. }
  24. func (m *MockModuleStore) RepoDiffNameOnly(repoPath, base, head string, opts ...git.DiffNameOnlyOptions) ([]string, error) {
  25. return m.repoDiffNameOnly(repoPath, base, head, opts...)
  26. }
  27. func (m *MockModuleStore) RepoLog(repoPath, rev string, opts ...git.LogOptions) ([]*git.Commit, error) {
  28. return m.repoLog(repoPath, rev, opts...)
  29. }
  30. func (m *MockModuleStore) RepoMergeBase(repoPath, base, head string, opts ...git.MergeBaseOptions) (string, error) {
  31. return m.repoMergeBase(repoPath, base, head, opts...)
  32. }
  33. func (m *MockModuleStore) RepoRemoveRemote(repoPath, name string, opts ...git.RemoveRemoteOptions) error {
  34. return m.repoRemoveRemote(repoPath, name, opts...)
  35. }
  36. func (m *MockModuleStore) RepoTags(repoPath string, opts ...git.TagsOptions) ([]string, error) {
  37. return m.repoTags(repoPath, opts...)
  38. }
  39. func (m *MockModuleStore) PullRequestMeta(headPath, basePath, headBranch, baseBranch string) (*PullRequestMeta, error) {
  40. return m.pullRequestMeta(headPath, basePath, headBranch, baseBranch)
  41. }
  42. func (m *MockModuleStore) ListTagsAfter(repoPath, after string, limit int) (*TagsPage, error) {
  43. return m.listTagsAfter(repoPath, after, limit)
  44. }
  45. func SetMockModuleStore(t *testing.T, mock ModuleStore) {
  46. before := Module
  47. Module = mock
  48. t.Cleanup(func() {
  49. Module = before
  50. })
  51. }
PANIC: session(release): write data/sessions/8/4/842036bc428ad8e3: no space left on device

PANIC

session(release): write data/sessions/8/4/842036bc428ad8e3: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)