porter_app.go 871 B

12345678910111213141516171819202122232425262728293031
  1. package test
  2. import (
  3. "errors"
  4. "strings"
  5. "github.com/porter-dev/porter/internal/models"
  6. "github.com/porter-dev/porter/internal/repository"
  7. )
  8. type PorterAppRepository struct {
  9. canQuery bool
  10. failingMethods string
  11. }
  12. func NewPorterAppRepository(canQuery bool, failingMethods ...string) repository.PorterAppRepository {
  13. return &PorterAppRepository{canQuery, strings.Join(failingMethods, ",")}
  14. }
  15. func (repo *PorterAppRepository) CreatePorterApp(app *models.PorterApp) (*models.PorterApp, error) {
  16. return nil, errors.New("cannot write database")
  17. }
  18. func (repo *PorterAppRepository) ReadPorterApp(clusterID uint, name string) (*models.PorterApp, error) {
  19. return nil, errors.New("cannot write database")
  20. }
  21. func (repo *PorterAppRepository) UpdatePorterApp(app *models.PorterApp) (*models.PorterApp, error) {
  22. return nil, errors.New("cannot write database")
  23. }