Skip to content

Conversation

@frhuelsz
Copy link
Contributor

@frhuelsz frhuelsz commented Jan 2, 2026

🔍 Description

Depends on:

Changes:

  • Adds AB update tests for configs that support it. Adds splits ab updates on test rings >= prerelease.
    image
  • Refactors to unify all test code on a single trident runtime kind enum.
  • Refactor netlaunch/netlisten to use a scoped http routing namespace instead of the global one. (In general the global one makes sense, since apps generally will just expose one server, but we start and stop http servers exposing the same endpoints, so we need to do so in separate scopes.)
  • Add more domain metadata to virtdeploy-go's output so that we can directly know more about the VM.
  • Refactor SSH tools to decouple configuration from CLI, since storm code does not consume ssh params via CLI.
  • Added a Host Config abstraction struct.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 9 comments.

Comment on lines +3 to +4
func (s *HostConfig) HasABUpdate() bool {
return s.Container.Exists("storage", "abUpdate")
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new HasABUpdate method only checks for the existence of "storage" and "abUpdate" keys but doesn't validate that abUpdate is not nil or has valid content. Consider adding validation to ensure the abUpdate configuration is actually usable.

Suggested change
func (s *HostConfig) HasABUpdate() bool {
return s.Container.Exists("storage", "abUpdate")
import (
"reflect"
"strings"
)
func (s *HostConfig) HasABUpdate() bool {
// First, confirm the key path exists as before.
if !s.Container.Exists("storage", "abUpdate") {
return false
}
// Use reflection to look for a Get("storage", "abUpdate") method on the container.
// This avoids relying on project-specific interfaces that may not exist.
containerValue := reflect.ValueOf(s.Container)
getMethod := containerValue.MethodByName("Get")
if !getMethod.IsValid() {
// No Get method available; fall back to the original Exists-based behavior.
return true
}
// Call Get("storage", "abUpdate") reflectively.
results := getMethod.Call([]reflect.Value{
reflect.ValueOf("storage"),
reflect.ValueOf("abUpdate"),
})
// If nothing was returned, treat it as unusable.
if len(results) == 0 {
return false
}
value := results[0].Interface()
if value == nil {
return false
}
// Apply simple sanity checks for common scalar types.
switch v := value.(type) {
case string:
return strings.TrimSpace(v) != ""
case []byte:
return len(v) > 0
default:
// For other non-nil types, assume the configuration is usable.
return true
}

Copilot uses AI. Check for mistakes.
return fmt.Errorf("failed to populate SSH client: %w", err)
}

sftpClient, err := sftp.NewSftpSudoClient(s.sshClient)
Copy link
Member

@bfjelds bfjelds Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not for this, but this upload code seems like a common chunk to make a shared storm function for

	sftpClient, err := sftp.NewSftpSudoClient(s.sshClient)
	if err != nil {
		return fmt.Errorf("failed to create SFTP sudo client: %w", err)
	}
	defer sftpClient.Close()

	// Write the updated host config to /tmp/host_config.yaml on the test host
	hostConfigFile, err := s.config.ToYaml()
	if err != nil {
		return fmt.Errorf("failed to render host configuration: %w", err)
	}

	remoteFile, err := sftpClient.Create(hostConfigRemotePath)
	if err != nil {
		return fmt.Errorf("failed to create remote host config file '%s': %w", hostConfigRemotePath, err)
	}
	defer remoteFile.Close()

	_, err = remoteFile.Write(hostConfigFile)
	if err != nil {
		remoteFile.Close()
		return fmt.Errorf("failed to write to remote host config file '%s': %w", hostConfigRemotePath, err)
	}

	err = remoteFile.Chmod(0644)
	if err != nil {
		return fmt.Errorf("failed to change permissions of new Host Config file: %w", err)
	}

	err = remoteFile.Chown(0, 0)
	if err != nil {
		return fmt.Errorf("failed to change ownership of new Host Config file: %w", err)
	}

Copilot AI review requested due to automatic review settings January 22, 2026 23:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 40 changed files in this pull request and generated 6 comments.

break
}

time.Sleep(backoff)
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backoff sleep at line 50 does not respect context cancellation. If the context is cancelled during the sleep, the function will continue to sleep for the full backoff duration before checking the context again. Consider using a select statement with ctx.Done() and time.After(backoff) to make the sleep interruptible.

Copilot uses AI. Check for mistakes.
bfjelds
bfjelds previously approved these changes Jan 23, 2026
Copilot AI review requested due to automatic review settings January 23, 2026 02:44
@frhuelsz
Copy link
Contributor Author

/AzurePipelines run [GITHUB]-trident-pr-e2e

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 33 out of 33 changed files in this pull request and generated 3 comments.

func (s *TridentE2EScenario) addSplitABUpdateTests(r storm.TestRegistrar, prefix string) {
filterSplitTestForCurrentRing := func(s *TridentE2EScenario, tc storm.TestCase, testFn func(storm.TestCase) error) error {
// The lowest ring for which we do split testing is 'prerelease'.
if s.args.TestRing < testrings.TestRingPre {
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comparison operator < performs string comparison on TestRing values, not the logical order comparison defined by the Compare method. This means the comparison will be based on alphabetical order of strings rather than the intended pipeline order (pr-e2e < ci < pre < full-validation). Use s.args.TestRing.Compare(testrings.TestRingPre) < 0 instead to ensure correct ring order comparison.

Suggested change
if s.args.TestRing < testrings.TestRingPre {
if s.args.TestRing.Compare(testrings.TestRingPre) < 0 {

Copilot uses AI. Check for mistakes.
}
defer sftpClient.Close()

// Write the updated host config to /tmp/host_config.yaml on the test host
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states the file will be written to '/tmp/host_config.yaml', but the actual path used is '/var/lib/trident/config.yaml' (defined in hostConfigRemotePath constant on line 26). Update the comment to match the actual file path.

Suggested change
// Write the updated host config to /tmp/host_config.yaml on the test host
// Write the updated host config to /var/lib/trident/config.yaml on the test host

Copilot uses AI. Check for mistakes.

func (s *TridentE2EScenario) checkTridentViaSshAfterInstall(tc storm.TestCase) error {
// Short timeout since we're expecting the host to already be up.
conn_ctx, cancel := context.WithTimeout(tc.Context(), time.Minute)
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable naming is inconsistent with Go conventions and the rest of the codebase. Use connCtx instead of conn_ctx to follow the camelCase convention used elsewhere (e.g., timeoutCtx on line 65).

Copilot uses AI. Check for mistakes.
@frhuelsz frhuelsz merged commit b99384f into main Jan 23, 2026
85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants