mirror of
				https://github.com/restic/restic.git
				synced 2025-11-04 04:16:58 +00:00 
			
		
		
		
	
		
			
	
	
		
			21 lines
		
	
	
		
			465 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			21 lines
		
	
	
		
			465 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								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.
							 | 
						||
| 
								 | 
							
								func TestNewCache(t testing.TB) (*Cache, func()) {
							 | 
						||
| 
								 | 
							
									dir, cleanup := test.TempDir(t)
							 | 
						||
| 
								 | 
							
									t.Logf("created new cache at %v", dir)
							 | 
						||
| 
								 | 
							
									cache, err := New(restic.NewRandomID().String(), dir)
							 | 
						||
| 
								 | 
							
									if err != nil {
							 | 
						||
| 
								 | 
							
										t.Fatal(err)
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									return cache, cleanup
							 | 
						||
| 
								 | 
							
								}
							 |