Skip to content

Commit

Permalink
test: enable port test
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrox committed Jun 30, 2024
1 parent 86ff9ed commit b3b40e6
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions zeropod/port_test.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
package zeropod

import (
"net/http/httptest"
"net/url"
"os"
"strconv"
"testing"
)

// func TestListeningPorts(t *testing.T) {
// ts := httptest.NewServer(nil)
"time"

// ports, err := ListeningPorts(os.Getpid())
// require.NoError(t, err)
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

// u, err := url.Parse(ts.URL)
// require.NoError(t, err)
func TestListeningPorts(t *testing.T) {
ts := httptest.NewServer(nil)
ts2 := httptest.NewServer(nil)
ports, err := listeningPortsDeep(os.Getpid())
require.NoError(t, err)

// port, err := strconv.ParseUint(u.Port(), 10, 16)
// require.NoError(t, err)
u, err := url.Parse(ts.URL)
require.NoError(t, err)
u2, err := url.Parse(ts2.URL)
require.NoError(t, err)

// assert.Contains(t, ports, uint16(port))
// }
port, err := strconv.Atoi(u.Port())
require.NoError(t, err)
port2, err := strconv.Atoi(u2.Port())
require.NoError(t, err)
assert.Contains(t, ports, uint16(port))
assert.Contains(t, ports, uint16(port2))

func TestInodes(t *testing.T) {
inodes(14819)
time.Sleep(time.Minute)
}

0 comments on commit b3b40e6

Please sign in to comment.