Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Commit

Permalink
Remove project_manager.go entirely; tests passing
Browse files Browse the repository at this point in the history
This is a major milestone. The old way of handling source information,
the projectManager, is totally gone, replaced by the new source-based
system. There's still work to be done there, but with tests passing,
we're more or less at parity with what we had before.
  • Loading branch information
sdboyer committed Aug 15, 2016
1 parent bc1bae3 commit 1006147
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 515 deletions.
21 changes: 7 additions & 14 deletions manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"os"
"path"
"path/filepath"
"runtime"
"sort"
"sync"
Expand Down Expand Up @@ -181,13 +182,17 @@ func TestProjectManagerInit(t *testing.T) {
}
}

// use ListPackages to ensure the repo is actually on disk
// TODO(sdboyer) ugh, maybe we do need an explicit prefetch method
smc.ListPackages(id, NewVersion("1.0.0"))

// Ensure that the appropriate cache dirs and files exist
_, err = os.Stat(path.Join(cpath, "sources", "https---github.com-Masterminds-VCSTestRepo", ".git"))
_, err = os.Stat(filepath.Join(cpath, "sources", "https---github.com-Masterminds-VCSTestRepo", ".git"))
if err != nil {
t.Error("Cache repo does not exist in expected location")
}

_, err = os.Stat(path.Join(cpath, "metadata", "github.com", "Masterminds", "VCSTestRepo", "cache.json"))
_, err = os.Stat(filepath.Join(cpath, "metadata", "github.com", "Masterminds", "VCSTestRepo", "cache.json"))
if err != nil {
// TODO(sdboyer) disabled until we get caching working
//t.Error("Metadata cache json file does not exist in expected location")
Expand All @@ -202,18 +207,6 @@ func TestProjectManagerInit(t *testing.T) {
if !exists {
t.Error("Source should exist after non-erroring call to ListVersions")
}

// Now reach inside the black box
pms, err := sm.getProjectManager(id)
if err != nil {
t.Errorf("Error on grabbing project manager obj: %s", err)
t.FailNow()
}

// Check upstream existence flag
if !pms.pm.CheckExistence(existsUpstream) {
t.Errorf("ExistsUpstream flag not being correctly set the project")
}
}

func TestGetSources(t *testing.T) {
Expand Down
305 changes: 0 additions & 305 deletions project_manager.go

This file was deleted.

14 changes: 14 additions & 0 deletions source.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ type sourceMetaCache struct {
// TODO(sdboyer) mutexes. actually probably just one, b/c complexity
}

// projectInfo holds manifest and lock
type projectInfo struct {
Manifest
Lock
}

type existence struct {
// The existence levels for which a search/check has been performed
s sourceExistence

// The existence levels verified to be present through searching
f sourceExistence
}

func newMetaCache() *sourceMetaCache {
return &sourceMetaCache{
infos: make(map[Revision]projectInfo),
Expand Down
Loading

0 comments on commit 1006147

Please sign in to comment.