forked from bazelbuild/remote-apis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Splitting cache_test into two for Windows (bazelbuild#139)
* Splitting cache_test into two for Windows * Adding GetCacheHits/Misses as part of the Cache interface to use in re-client.
- Loading branch information
Ola Rozenfeld
authored
Jun 24, 2020
1 parent
d78b5ea
commit 17eef19
Showing
8 changed files
with
111 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// +build !windows | ||
|
||
package filemetadata | ||
|
||
import ( | ||
"io/ioutil" | ||
"os" | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
"github.com/google/go-cmp/cmp/cmpopts" | ||
) | ||
|
||
func TestExecutableCacheLoad(t *testing.T) { | ||
c := NewSingleFlightCache() | ||
filename, err := createFile(t, true, "") | ||
if err != nil { | ||
t.Fatalf("Failed to create tmp file for testing digests: %v", err) | ||
} | ||
if err = ioutil.WriteFile(filename, contents, os.ModeTemporary); err != nil { | ||
t.Fatalf("Failed to write to tmp file for testing digests: %v", err) | ||
} | ||
got := c.Get(filename) | ||
if got.Err != nil { | ||
t.Errorf("Get(%v) failed. Got error: %v", filename, got.Err) | ||
} | ||
want := &Metadata{ | ||
Digest: wantDg, | ||
IsExecutable: true, | ||
} | ||
if diff := cmp.Diff(want, got, cmpopts.IgnoreFields(Metadata{}, "MTime")); diff != "" { | ||
t.Errorf("Get(%v) returned diff. (-want +got)\n%s", filename, diff) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters