Skip to content

Commit 1494731

Browse files
mangalaman93harshil-goel
authored andcommitted
upgrade go mod (#9115)
1 parent 65dbc9d commit 1494731

13 files changed

+424
-630
lines changed

.github/workflows/cd-dgraph.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
go-version: ${{ env.GOVERSION }}
3333
- name: Install protobuf-compiler
34-
run: sudo apt-get install -y protobuf-compiler
34+
run: sudo apt update && sudo apt install -y protobuf-compiler
3535
- name: Check protobuf
3636
run: |
3737
cd ./protos
@@ -126,7 +126,7 @@ jobs:
126126
with:
127127
go-version: ${{ env.GOVERSION }}
128128
- name: Install protobuf-compiler
129-
run: sudo apt-get install -y protobuf-compiler
129+
run: sudo apt update && sudo apt install -y protobuf-compiler
130130
- name: Check protobuf
131131
run: |
132132
cd ./protos

.github/workflows/ci-dgraph-code-coverage.yml

-12
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@ jobs:
3636
uses: actions/setup-go@v5
3737
with:
3838
go-version: ${{ env.GOVERSION }}
39-
- name: Set up Node
40-
uses: actions/setup-node@v3
41-
with:
42-
node-version: 16
43-
- name: Install protobuf-compiler
44-
run: sudo apt-get install -y protobuf-compiler
45-
- name: Check protobuf
46-
run: |
47-
cd ./protos
48-
go mod tidy
49-
make regenerate
50-
git diff --exit-code -- .
5139
- name: Make Linux Build and Docker Image with coverage enabled
5240
run: make coverage-docker-image
5341
- name: Build Test Binary

.github/workflows/ci-dgraph-ldbc-tests.yml

-12
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@ jobs:
4343
uses: actions/setup-go@v5
4444
with:
4545
go-version: ${{ env.GOVERSION }}
46-
- name: Set up Node
47-
uses: actions/setup-node@v4
48-
with:
49-
node-version: 16
50-
- name: Install protobuf-compiler
51-
run: sudo apt-get install -y protobuf-compiler
52-
- name: Check protobuf
53-
run: |
54-
cd ./protos
55-
go mod tidy
56-
make regenerate
57-
git diff --exit-code -- .
5846
- name: Make Linux Build and Docker Image
5947
run: make docker-image
6048
- name: Build Test Binary

.github/workflows/ci-dgraph-load-tests.yml

-12
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ jobs:
4242
uses: actions/setup-go@v5
4343
with:
4444
go-version: ${{ env.GOVERSION }}
45-
- name: Set up Node
46-
uses: actions/setup-node@v4
47-
with:
48-
node-version: 16
49-
- name: Install protobuf-compiler
50-
run: sudo apt-get install -y protobuf-compiler
51-
- name: Check protobuf
52-
run: |
53-
cd ./protos
54-
go mod tidy
55-
make regenerate
56-
git diff --exit-code -- .
5745
- name: Make Linux Build and Docker Image
5846
run: make docker-image # this internally builds dgraph binary
5947
- name: Build Test Binary

.github/workflows/ci-dgraph-tests-arm64.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@ jobs:
4242
uses: actions/setup-go@v5
4343
with:
4444
go-version: ${{ env.GOVERSION }}
45-
- name: Set up Node
46-
uses: actions/setup-node@v4
47-
with:
48-
node-version: 16
4945
- name: Install protobuf-compiler
50-
run: sudo apt-get install -y protobuf-compiler
46+
run: sudo apt update && sudo apt install -y protobuf-compiler
5147
- name: Check protobuf
5248
run: |
5349
cd ./protos

.github/workflows/ci-dgraph-tests.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,8 @@ jobs:
4242
uses: actions/setup-go@v5
4343
with:
4444
go-version: ${{ env.GOVERSION }}
45-
- name: Set up Node
46-
uses: actions/setup-node@v4
47-
with:
48-
node-version: 16
4945
- name: Install protobuf-compiler
50-
run: sudo apt-get install -y protobuf-compiler
46+
run: sudo apt update && sudo apt install -y protobuf-compiler
5147
- name: Check protobuf
5248
run: |
5349
cd ./protos

dgraphtest/local_cluster.go

+13-61
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ func (c *LocalCluster) destroyContainers() error {
268268
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
269269
defer cancel()
270270

271-
ro := types.ContainerRemoveOptions{RemoveVolumes: true, Force: true}
271+
ro := container.RemoveOptions{RemoveVolumes: true, Force: true}
272272
for _, zo := range c.zeros {
273273
if err := c.dcli.ContainerRemove(ctx, zo.cid(), ro); err != nil {
274274
return errors.Wrapf(err, "error removing zero [%v]", zo.cname())
@@ -284,38 +284,21 @@ func (c *LocalCluster) destroyContainers() error {
284284
return nil
285285
}
286286

287-
// CheckRunningServices checks open ports using lsof and returns the output as a string
288-
func CheckRunningServices() (string, error) {
289-
lsofCmd := exec.Command("lsof", "-i", "-n")
290-
output, err := runCommand(lsofCmd)
287+
func (c *LocalCluster) printPortMappings() error {
288+
containers, err := c.dcli.ContainerList(context.Background(), container.ListOptions{})
291289
if err != nil {
292-
return "", fmt.Errorf("error running lsof command: %v", err)
293-
}
294-
return output, nil
295-
}
296-
297-
// ListRunningContainers lists running Docker containers using the Docker Go client
298-
func (c *LocalCluster) listRunningContainers() (string, error) {
299-
containers, err := c.dcli.ContainerList(context.Background(), types.ContainerListOptions{})
300-
if err != nil {
301-
return "", fmt.Errorf("error listing Docker containers: %v", err)
290+
return errors.Wrap(err, "error listing docker containers")
302291
}
303292

304293
var result bytes.Buffer
305294
for _, container := range containers {
306295
result.WriteString(fmt.Sprintf("ID: %s, Image: %s, Command: %s, Status: %s\n",
307296
container.ID[:10], container.Image, container.Command, container.Status))
308297

309-
result.WriteString("Port Mappings:\n")
310-
for _, port := range container.Ports {
311-
result.WriteString(fmt.Sprintf(" %s:%d -> %d\n", port.IP, port.PublicPort, port.PrivatePort))
312-
}
313-
result.WriteString("\n")
314-
315298
result.WriteString("Port Mappings:\n")
316299
info, err := c.dcli.ContainerInspect(context.Background(), container.ID)
317300
if err != nil {
318-
return "", errors.Wrap(err, "error inspecting container")
301+
return errors.Wrapf(err, "error inspecting container [%v]", container.ID)
319302
}
320303

321304
for port, bindings := range info.NetworkSettings.Ports {
@@ -327,42 +310,9 @@ func (c *LocalCluster) listRunningContainers() (string, error) {
327310
result.WriteString("\n")
328311
}
329312

330-
return result.String(), nil
331-
}
332-
333-
// runCommand executes a command and returns its output or an error
334-
func runCommand(cmd *exec.Cmd) (string, error) {
335-
var out bytes.Buffer
336-
var stderr bytes.Buffer
337-
cmd.Stdout = &out
338-
cmd.Stderr = &stderr
339-
err := cmd.Run()
340-
if err != nil {
341-
return "", fmt.Errorf("%v: %v", err, stderr.String())
342-
}
343-
return out.String(), nil
344-
}
345-
346-
func (c *LocalCluster) printNetworkStuff() {
347-
log.Printf("Checking running services and ports using lsof, netstat, and Docker...\n")
348-
349-
// Check running services using lsof
350-
lsofOutput, err := CheckRunningServices()
351-
if err != nil {
352-
fmt.Printf("Error checking running services: %v\n", err)
353-
} else {
354-
log.Printf("Output of lsof -i:")
355-
log.Println(lsofOutput)
356-
}
357-
358-
// List running Docker containers
359-
dockerOutput, err := c.listRunningContainers()
360-
if err != nil {
361-
fmt.Printf("Error listing Docker containers: %v\n", err)
362-
} else {
363-
log.Printf("Running Docker containers:")
364-
log.Println(dockerOutput)
365-
}
313+
log.Printf("[INFO] ======== CONTAINERS' PORT MAPPINGS ========")
314+
log.Println(result.String())
315+
return nil
366316
}
367317

368318
func (c *LocalCluster) Cleanup(verbose bool) {
@@ -377,6 +327,9 @@ func (c *LocalCluster) Cleanup(verbose bool) {
377327
if err := c.printInspectContainers(); err != nil {
378328
log.Printf("[WARNING] error printing inspect container output: %v", err)
379329
}
330+
if err := c.printPortMappings(); err != nil {
331+
log.Printf("[WARNING] error printing port mappings: %v", err)
332+
}
380333
}
381334

382335
log.Printf("[INFO] cleaning up cluster with prefix [%v]", c.conf.prefix)
@@ -489,7 +442,7 @@ func (c *LocalCluster) StartAlpha(id int) error {
489442
func (c *LocalCluster) startContainer(dc dnode) error {
490443
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
491444
defer cancel()
492-
if err := c.dcli.ContainerStart(ctx, dc.cid(), types.ContainerStartOptions{}); err != nil {
445+
if err := c.dcli.ContainerStart(ctx, dc.cid(), container.StartOptions{}); err != nil {
493446
return errors.Wrapf(err, "error starting container [%v]", dc.cname())
494447
}
495448
dc.changeStatus(true)
@@ -641,7 +594,6 @@ func (c *LocalCluster) containerHealthCheck(url func(c *LocalCluster) (string, e
641594
return nil
642595
}
643596

644-
c.printNetworkStuff()
645597
return fmt.Errorf("health failed, cluster took too long to come up [%v]", endpoint)
646598
}
647599

@@ -1044,7 +996,7 @@ func (c *LocalCluster) getLogs(containerID string) (string, error) {
1044996
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
1045997
defer cancel()
1046998

1047-
opts := types.ContainerLogsOptions{
999+
opts := container.LogsOptions{
10481000
ShowStdout: true,
10491001
ShowStderr: true,
10501002
Details: true,

edgraph/access_ee_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,11 @@ func TestGetRefreshJwt(t *testing.T) {
115115
}
116116

117117
func TestMain(m *testing.M) {
118+
worker.Config.AclJwtAlg = jwt.SigningMethodHS256
118119
x.WorkerConfig.AclJwtAlg = jwt.SigningMethodHS256
119120
x.WorkerConfig.AclPublicKey = x.Sensitive("6ABBAA2014CFF00289D20D20DA296F67")
120-
121121
worker.Config.AccessJwtTtl = 20 * time.Second
122122
worker.Config.RefreshJwtTtl = 20 * time.Second
123123
worker.Config.AclSecretKey = x.Sensitive("6ABBAA2014CFF00289D20D20DA296F67")
124+
m.Run()
124125
}

0 commit comments

Comments
 (0)