Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for tempfile (0.5 sec)

  1. internal/config/certs_test.go

    func createTempFile(prefix, content string) (tempFile string, err error) {
    	var tmpfile *os.File
    
    	if tmpfile, err = os.CreateTemp("", prefix); err != nil {
    		return tempFile, err
    	}
    
    	if _, err = tmpfile.Write([]byte(content)); err != nil {
    		return tempFile, err
    	}
    
    	if err = tmpfile.Close(); err != nil {
    		return tempFile, err
    	}
    
    	tempFile = tmpfile.Name()
    	return tempFile, err
    }
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Mon Sep 19 18:05:16 GMT 2022
    - 21.6K bytes
    - Viewed (0)
  2. cmd/xl-storage-errors.go

    	return errors.Is(err, syscall.EXDEV)
    }
    
    // Check if given error corresponds to too many open files
    func isSysErrTooManyFiles(err error) bool {
    	return errors.Is(err, syscall.ENFILE) || errors.Is(err, syscall.EMFILE)
    }
    
    func osIsNotExist(err error) bool {
    	return errors.Is(err, os.ErrNotExist)
    }
    
    func osIsPermission(err error) bool {
    	return errors.Is(err, os.ErrPermission) || errors.Is(err, syscall.EROFS)
    }
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Mon Mar 06 16:56:29 GMT 2023
    - 3.8K bytes
    - Viewed (0)
  3. cmd/test-utils_test.go

    	// Fetch TLS key and pem files from test-data/ directory.
    	//	dir, _ := os.Getwd()
    	//	testDataDir := filepath.Join(filepath.Dir(dir), "test-data")
    	//
    	//	pemFile := filepath.Join(testDataDir, "server.pem")
    	//	keyFile := filepath.Join(testDataDir, "server.key")
    	cer, err := tls.X509KeyPair(cert, key)
    	if err != nil {
    		t.Fatalf("Failed to load certificate: %v", err)
    	}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri May 03 17:26:51 GMT 2024
    - 76.2K bytes
    - Viewed (0)
  4. cmd/common-main_test.go

    		},
    	}
    
    	for _, testCase := range testCases {
    		testCase := testCase
    		t.Run("", func(t *testing.T) {
    			tmpfile, err := os.CreateTemp("", "testfile")
    			if err != nil {
    				t.Error(err)
    			}
    			tmpfile.WriteString(testCase.content)
    			tmpfile.Sync()
    			tmpfile.Close()
    
    			value, err := readFromSecret(tmpfile.Name())
    			if err != nil && !testCase.expectedErr {
    				t.Error(err)
    			}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Mon Sep 19 18:05:16 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  5. cmd/bitrot_test.go

    package cmd
    
    import (
    	"context"
    	"io"
    	"testing"
    )
    
    func testBitrotReaderWriterAlgo(t *testing.T, bitrotAlgo BitrotAlgorithm) {
    	tmpDir := t.TempDir()
    
    	volume := "testvol"
    	filePath := "testfile"
    
    	disk, err := newLocalXLStorage(tmpDir)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	disk.MakeVol(context.Background(), volume)
    
    	writer := newBitrotWriter(disk, "", volume, filePath, 35, bitrotAlgo, 10)
    
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Jan 30 20:43:25 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  6. internal/disk/stat_test.go

    	}
    
    	for _, testCase := range testCases {
    		testCase := testCase
    		t.Run("", func(t *testing.T) {
    			tmpfile, err := os.CreateTemp("", "testfile")
    			if err != nil {
    				t.Error(err)
    			}
    			tmpfile.WriteString(testCase.stat)
    			tmpfile.Sync()
    			tmpfile.Close()
    
    			iostats, err := readDriveStats(tmpfile.Name())
    			if err != nil && !testCase.expectErr {
    				t.Fatalf("unexpected err; %v", err)
    			}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Mon Feb 26 19:34:50 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  7. cmd/update_test.go

    func TestGetHelmVersion(t *testing.T) {
    	createTempFile := func(content string) string {
    		tmpfile, err := os.CreateTemp("", "helm-testfile-")
    		if err != nil {
    			t.Fatalf("Unable to create temporary file. %s", err)
    		}
    		if _, err = tmpfile.WriteString(content); err != nil {
    			t.Fatalf("Unable to create temporary file. %s", err)
    		}
    		if err = tmpfile.Close(); err != nil {
    			t.Fatalf("Unable to create temporary file. %s", err)
    		}
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sat Mar 09 03:07:08 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  8. src/archive/tar/tar_test.go

    	"time"
    )
    
    type testError struct{ error }
    
    type fileOps []any // []T where T is (string | int64)
    
    // testFile is an io.ReadWriteSeeker where the IO operations performed
    // on it must match the list of operations in ops.
    type testFile struct {
    	ops fileOps
    	pos int64
    }
    
    func (f *testFile) Read(b []byte) (int, error) {
    	if len(b) == 0 {
    		return 0, nil
    	}
    	if len(f.ops) == 0 {
    		return 0, io.EOF
    	}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Fri Mar 15 16:01:50 GMT 2024
    - 24K bytes
    - Viewed (0)
  9. src/archive/tar/writer_test.go

    			hdr     Header
    			wantErr error
    		}
    		testWrite struct { // Write(str) == (wantCnt, wantErr)
    			str     string
    			wantCnt int
    			wantErr error
    		}
    		testReadFrom struct { // ReadFrom(testFile{ops}) == (wantCnt, wantErr)
    			ops     fileOps
    			wantCnt int64
    			wantErr error
    		}
    		testClose struct { // Close() == wantErr
    			wantErr error
    		}
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Feb 27 16:39:23 GMT 2024
    - 38.7K bytes
    - Viewed (0)
  10. src/archive/tar/reader_test.go

    }
    
    func TestFileReader(t *testing.T) {
    	type (
    		testRead struct { // Read(cnt) == (wantStr, wantErr)
    			cnt     int
    			wantStr string
    			wantErr error
    		}
    		testWriteTo struct { // WriteTo(testFile{ops}) == (wantCnt, wantErr)
    			ops     fileOps
    			wantCnt int64
    			wantErr error
    		}
    		testRemaining struct { // logicalRemaining() == wantLCnt, physicalRemaining() == wantPCnt
    			wantLCnt int64
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Nov 21 21:14:38 GMT 2022
    - 47.1K bytes
    - Viewed (0)
Back to top