Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 70 for defer (0.2 sec)

  1. cni/pkg/plugin/cnieventclient_test.go

    	testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
    		res.WriteHeader(http.StatusOK)
    		res.Write([]byte("server happy"))
    	}))
    	defer func() { testServer.Close() }()
    
    	cniC := fakeCNIEventClient(testServer.URL)
    
    	err := PushCNIEvent(cniC, fakeCmdArgs, []*cniv1.IPConfig{&fakePrevResultIPConfig}, "testpod", "testns")
    
    	assert.NoError(t, err)
    }
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  2. istioctl/pkg/writer/envoy/configdump/secret_test.go

    	if err != nil {
    		t.Errorf("error opening test data file: %v", err)
    	}
    	defer configDumpFile.Close()
    	configDump, err := io.ReadAll(configDumpFile)
    	if err != nil {
    		t.Errorf("error reading test data file: %v", err)
    	}
    
    	outFile, err := os.Open("testdata/secret/output")
    	if err != nil {
    		t.Errorf("error opening test data output file: %v", err)
    	}
    	defer outFile.Close()
    	expectedOut, err := io.ReadAll(outFile)
    	if err != nil {
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Tue Jun 06 15:14:48 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  3. cni/pkg/nodeagent/pod_cache.go

    func (p *podNetnsCache) Get(uid string) Netns {
    	// lock current snapshot pod map
    	p.mu.RLock()
    	defer p.mu.RUnlock()
    	if info, f := p.currentPodCache[uid]; f {
    		return info.Netns
    	}
    	return nil
    }
    
    // make sure uid is in the cache, even if we don't have a netns
    func (p *podNetnsCache) Ensure(uid string) {
    	p.mu.Lock()
    	defer p.mu.Unlock()
    	if _, ok := p.currentPodCache[uid]; !ok {
    		p.currentPodCache[uid] = WorkloadInfo{}
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 4.5K bytes
    - Viewed (0)
  4. cni/pkg/nodeagent/netns_linux_test.go

    	}
    	// the inode for netns is proc dynamic, so it needs to be higher than
    	// #define PROC_DYNAMIC_FIRST 0xF0000000U
    
    	if ns.Inode() < 0xF0000000 {
    		t.Fatalf("unexpected inode: %v", ns.Inode())
    	}
    	defer ns.Close()
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 976 bytes
    - Viewed (0)
  5. cni/pkg/nodeagent/cni-watcher_test.go

    		PodName:      "pod-bingo",
    		PodNamespace: "funkyns",
    		IPs: []IPConfig{{
    			Address: *addr,
    		}},
    	}
    
    	setupLogging()
    	NodeName = "testnode"
    	ctx, cancel := context.WithCancel(context.Background())
    	defer cancel()
    	pod := &corev1.Pod{
    		ObjectMeta: metav1.ObjectMeta{
    			Name:      "pod-bingo",
    			Namespace: "funkyns",
    		},
    		Spec: corev1.PodSpec{
    			NodeName: NodeName,
    		},
    		Status: corev1.PodStatus{
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Feb 02 08:18:40 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  6. cni/pkg/nodeagent/server_test.go

    	if f.testWG != nil {
    		defer f.testWG.Done()
    	}
    	args := f.Called(ctx, pod, podIPs, netNs)
    	return args.Error(0)
    }
    
    func (f *fakeServer) RemovePodFromMesh(ctx context.Context, pod *corev1.Pod) error {
    	if f.testWG != nil {
    		defer f.testWG.Done()
    	}
    	args := f.Called(ctx, pod)
    	return args.Error(0)
    }
    
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  7. cni/pkg/install/cniconfig_test.go

    			}
    
    			if !c.chainedCNIPlugin {
    				// Standalone CNI plugin
    				parent := context.Background()
    				ctx1, cancel := context.WithTimeout(parent, 100*time.Millisecond)
    				defer cancel()
    				result, err := getCNIConfigFilepath(ctx1, cfg)
    				if err != nil {
    					assert.Equal(t, result, "")
    					if err == context.DeadlineExceeded {
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Wed May 17 02:22:22 GMT 2023
    - 15.4K bytes
    - Viewed (0)
  8. cni/pkg/plugin/sidecar_iptables_linux.go

    	}
    
    	netNs, err := getNs(netns)
    	if err != nil {
    		err = fmt.Errorf("failed to open netns %q: %s", netns, err)
    		return err
    	}
    	defer netNs.Close()
    
    	return netNs.Do(func(_ ns.NetNS) error {
    		log.Infof("============= Start iptables configuration for %v =============", podName)
    		defer log.Infof("============= End iptables configuration for %v =============", podName)
    		return cmd.ProgramIptables(cfg)
    	})
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Thu Apr 18 17:36:41 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  9. cni/pkg/plugin/cnieventclient.go

    	if err != nil {
    		return err
    	}
    	var response *http.Response
    	response, err = cniClient.client.Post(cniClient.url, "application/json", bytes.NewBuffer(eventData))
    	if err != nil {
    		return err
    	}
    	defer response.Body.Close()
    
    	if response.StatusCode != http.StatusOK {
    		return fmt.Errorf("unable to push CNI event, error was %d", response.StatusCode)
    	}
    
    	return nil
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 2.4K bytes
    - Viewed (0)
  10. cni/pkg/nodeagent/netns_linux.go

    		threadNS, err := netns.GetCurrentNS()
    		if err != nil {
    			return fmt.Errorf("failed to open current netns: %v", err)
    		}
    		defer threadNS.Close()
    
    		// switch to target namespace
    		if err = NetnsSet(fdable); err != nil {
    			return err
    		}
    		defer func() {
    			err := threadNS.Set() // switch back
    			if err == nil {
    				// Unlock the current thread only when we successfully switched back
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Wed Jan 31 10:05:36 GMT 2024
    - 2.7K bytes
    - Viewed (0)
Back to top