Skip to content

Commit

Permalink
Merge branch 'master' into lujieduan-remove-centos7-gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
LujieDuan authored Nov 28, 2024
2 parents 4a89aa8 + 703b46b commit fe6fddb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
8 changes: 4 additions & 4 deletions dev-docs/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ $ tree $CONFIG_OUT
```

* Sample generated
[golden fluent bit main conf](https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/valid/linux/default_config/golden_fluent_bit_main.conf)
[golden fluent bit main conf](https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/goldens/builtin/golden/linux/fluent_bit_main.conf)
at `$CONFIG_OUT/fluent_bit_main.conf`.
* Sample generated
[golden fluent bit parser conf](https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/valid/linux/default_config/golden_fluent_bit_parser.conf)
[golden fluent bit parser conf](https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/goldens/builtin/golden/linux/fluent_bit_parser.conf)
at `$CONFIG_OUT/fluent_bit_parser.conf`.
* Sample generated
[golden otel conf](https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/valid/linux/default_config/golden_otel.conf)
at `$CONFIG_OUT/otel.conf`.
[golden otel yaml](https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/goldens/builtin/golden/linux/otel.yaml)
at `$CONFIG_OUT/otel.yaml`.

## Build and test manually on GCE VMs

Expand Down
19 changes: 19 additions & 0 deletions integration_test/gce/gce_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,25 @@ func addFrameworkMetadata(imageSpec string, inputMetadata map[string]string) (ma
if _, ok := metadataCopy["startup-script"]; ok {
return nil, errors.New("the 'startup-script' metadata key is reserved for future use. Instead, wait for the instance to be ready and then run things with RunRemotely() or RunScriptRemotely()")
}
// TODO(b/380470389): we actually *can't* do RunRemotely() on DLVM images due to a bug.
// The workaround for the bug is to deploy a fix in-VM via startup scripts.
if strings.Contains(imageSpec, "common-gpu-debian-11-py310") {
metadataCopy["startup-script"] = fmt.Sprintf(`
#!/bin/bash
# Give time for the guest agent and jupyter stuff to finish modifying
# /etc/passwd and test_user home directory
sleep 120
HOMEDIR=/home/%[1]s
SSHFILE=$HOMEDIR/.ssh/authorized_keys
if [ ! -f "$SSHFILE" ]; then
sudo mkdir -p "$HOMEDIR/.ssh"
sudo touch "$SSHFILE"
fi
sudo chown -R %[1]s:%[1]s "$HOMEDIR"
sudo chmod 600 "$SSHFILE"`,
sshUserName,
)
}
}
return metadataCopy, nil
}
Expand Down
31 changes: 16 additions & 15 deletions transformation_test/transformation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,24 @@ func (transformationConfig transformationTest) runOTelTestInner(t *testing.T, na
}

var errors []any
var exitErr error

// Read from stderr until EOF and put any errors in `errors`.
eg.Go(func() error {
// Wait for the process to exit.
defer eg.Go(func() error {
if err := cmd.Wait(); err != nil {
if _, ok := err.(*exec.ExitError); ok {
exitErr = err
t.Logf("process terminated with error: %v", err)
} else {
return fmt.Errorf("process failed: %w", err)
}
}
cancel()
return nil
})

consumingCount := 0
r := bufio.NewReader(stderr)
d := json.NewDecoder(r)
Expand Down Expand Up @@ -498,6 +513,7 @@ func (transformationConfig transformationTest) runOTelTestInner(t *testing.T, na
}
}
})

// Read and sanitize requests.
eg.Go(func() error {
for r := range requestCh {
Expand All @@ -506,21 +522,6 @@ func (transformationConfig transformationTest) runOTelTestInner(t *testing.T, na
return nil
})

var exitErr error
// Wait for the process to exit.
eg.Go(func() error {
if err := cmd.Wait(); err != nil {
if _, ok := err.(*exec.ExitError); ok {
exitErr = err
t.Logf("process terminated with error: %v", err)
} else {
return fmt.Errorf("process failed: %w", err)
}
}
cancel()
return nil
})

if err := eg.Wait(); err != nil {
t.Errorf("errgroup failed: %v", err)
}
Expand Down

0 comments on commit fe6fddb

Please sign in to comment.