mirror of
				https://github.com/containers/podman.git
				synced 2025-11-04 00:50:15 +08:00 
			
		
		
		
	given that we are moving to building our own machine images, we have decided to use zstd compression as it is superior in speed to the alternatives. as such, this pr adds zstd to our machine code; and also has to account for dealing with sparseness on darwin; which the default zstd golang library does not. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
		
			
				
	
	
		
			75 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package define
 | 
						|
 | 
						|
import "testing"
 | 
						|
 | 
						|
func TestImageFormat_Kind(t *testing.T) {
 | 
						|
	tests := []struct {
 | 
						|
		name string
 | 
						|
		imf  ImageFormat
 | 
						|
		want string
 | 
						|
	}{
 | 
						|
		{
 | 
						|
			name: "vhdx",
 | 
						|
			imf:  Vhdx,
 | 
						|
			want: "vhdx",
 | 
						|
		},
 | 
						|
		{
 | 
						|
			name: "qcow2",
 | 
						|
			imf:  Qcow,
 | 
						|
			want: "qcow2",
 | 
						|
		},
 | 
						|
		{
 | 
						|
			name: "raw",
 | 
						|
			imf:  Raw,
 | 
						|
			want: "raw",
 | 
						|
		},
 | 
						|
		{
 | 
						|
			name: "tar",
 | 
						|
			imf:  Tar,
 | 
						|
			want: "tar",
 | 
						|
		},
 | 
						|
	}
 | 
						|
	for _, tt := range tests {
 | 
						|
		t.Run(tt.name, func(t *testing.T) {
 | 
						|
			if got := tt.imf.Kind(); got != tt.want {
 | 
						|
				t.Errorf("Kind() = %v, want %v", got, tt.want)
 | 
						|
			}
 | 
						|
		})
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
func TestImageFormat_KindWithCompression(t *testing.T) {
 | 
						|
	tests := []struct {
 | 
						|
		name string
 | 
						|
		imf  ImageFormat
 | 
						|
		want string
 | 
						|
	}{
 | 
						|
		{
 | 
						|
			name: "vhdx",
 | 
						|
			imf:  Vhdx,
 | 
						|
			want: "vhdx.zst",
 | 
						|
		},
 | 
						|
		{
 | 
						|
			name: "qcow2",
 | 
						|
			imf:  Qcow,
 | 
						|
			want: "qcow2.zst",
 | 
						|
		},
 | 
						|
		{
 | 
						|
			name: "raw",
 | 
						|
			imf:  Raw,
 | 
						|
			want: "raw.zst",
 | 
						|
		}, {
 | 
						|
			name: "tar.xz",
 | 
						|
			imf:  Tar,
 | 
						|
			want: "tar.xz",
 | 
						|
		},
 | 
						|
	}
 | 
						|
	for _, tt := range tests {
 | 
						|
		t.Run(tt.name, func(t *testing.T) {
 | 
						|
			if got := tt.imf.KindWithCompression(); got != tt.want {
 | 
						|
				t.Errorf("String() = %v, want %v", got, tt.want)
 | 
						|
			}
 | 
						|
		})
 | 
						|
	}
 | 
						|
}
 |