| 
									
										
										
										
											2017-06-10 13:10:08 +02:00
										 |  |  | package cache | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"testing" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/restic/restic/internal/restic" | 
					
						
							|  |  |  | 	"github.com/restic/restic/internal/test" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // TestNewCache returns a cache in a temporary directory which is removed when | 
					
						
							|  |  |  | // cleanup is called. | 
					
						
							| 
									
										
										
										
											2022-12-09 13:42:33 +01:00
										 |  |  | func TestNewCache(t testing.TB) *Cache { | 
					
						
							|  |  |  | 	dir := test.TempDir(t) | 
					
						
							| 
									
										
										
										
											2017-06-10 13:10:08 +02:00
										 |  |  | 	t.Logf("created new cache at %v", dir) | 
					
						
							|  |  |  | 	cache, err := New(restic.NewRandomID().String(), dir) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		t.Fatal(err) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-12-09 13:42:33 +01:00
										 |  |  | 	return cache | 
					
						
							| 
									
										
										
										
											2017-06-10 13:10:08 +02:00
										 |  |  | } |