Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestManager: Add flexibility to displayed columns #777

Merged
merged 1 commit into from
Mar 11, 2023

Conversation

ecpullen
Copy link
Contributor

@ecpullen ecpullen commented Mar 1, 2023

Issue number:

N/A

Description of changes:

This pr allows users to have full control over the status that is displayed. Several useful status columns are provided see cli/src/status.rs. This will enable improved status display in the Bottlerocket repo.

The following status was created using the accompanying code snippet.

 VARIANT            ARCH        TYPE           CLUSTER                    PASSED      FAILED      SKIPPED 
 aws-k8s-1.23       x86_64      migration      x86-64-aws-k8s-124              1        6972            0 
 aws-k8s-1.23       x86_64      migration      x86-64-aws-k8s-124              2           0            0 
 aws-k8s-1.23       x86_64      migration      x86-64-aws-k8s-124              1        6972            0 
 aws-k8s-1.23       x86_64      migration      x86-64-aws-k8s-124              2           0            0 
 aws-k8s-1.23       x86_64      migration      x86-64-aws-k8s-124              1        6972            0 
 aws-k8s-1.24       x86_64      workload       x86-64-aws-k8s-124                                         
 aws-k8s-1.23       x86_64      cluster        x86-64-aws-k8s-124                                         
 aws-k8s-1.24       x86_64      instances      x86-64-aws-k8s-124                                        
status.new_column("VARIANT", |crd| {
            crd.labels()
                .get("testsys/variant")
                .cloned()
                .into_iter()
                .collect()
        });
        status.new_column("ARCH", |crd| {
            crd.labels()
                .get("testsys/arch")
                .cloned()
                .into_iter()
                .collect()
        });
        status.new_column("TYPE", |crd| {
            crd.labels()
                .get("testsys/type")
                .cloned()
                .into_iter()
                .collect()
        });
        status.new_column("CLUSTER", |crd| {
            crd.labels()
                .get("testsys/cluster")
                .cloned()
                .into_iter()
                .collect()
        });

        status.add_column(StatusColumn::passed());
        status.add_column(StatusColumn::failed());
        status.add_column(StatusColumn::skipped());

User are also able to provide multiple values for a single crd such as listing all of a crds labels.

 NAME                                    ARCH       LABELS                                
 x86-64-aws-k8s-124-1-initial            foo        testsys/arch=x86_64                   
                                                    testsys/build-id=ee669023             
                                                    testsys/cluster=x86-64-aws-k8s-124    
                                                    testsys/flavor=migration              
                                                    testsys/test-type=migration           
                                                    testsys/type=migration                
                                                    testsys/variant=aws-k8s-1.23          
 x86-64-aws-k8s-124-2-migrate            foo        testsys/arch=x86_64                   
                                                    testsys/build-id=ee669023             
                                                    testsys/cluster=x86-64-aws-k8s-124    
                                                    testsys/test-type=migration           
                                                    testsys/type=migration                
                                                    testsys/variant=aws-k8s-1.23          
 x86-64-aws-k8s-124-3-migrated           foo        testsys/arch=x86_64                   
                                                    testsys/build-id=ee669023             
                                                    testsys/cluster=x86-64-aws-k8s-124    
                                                    testsys/flavor=migration              
                                                    testsys/test-type=migration           
                                                    testsys/type=migration                
                                                    testsys/variant=aws-k8s-1.23          
 x86-64-aws-k8s-124-4-migrate            foo        testsys/arch=x86_64                   
                                                    testsys/build-id=ee669023             
                                                    testsys/cluster=x86-64-aws-k8s-124    
                                                    testsys/test-type=migration           
                                                    testsys/type=migration                
                                                    testsys/variant=aws-k8s-1.23          
 x86-64-aws-k8s-124-5-final              foo        testsys/arch=x86_64                   
                                                    testsys/build-id=ee669023             
                                                    testsys/cluster=x86-64-aws-k8s-124    
                                                    testsys/flavor=migration              
                                                    testsys/test-type=migration           
                                                    testsys/type=migration                
                                                    testsys/variant=aws-k8s-1.23          
 x86-64-aws-k8s-124-test                 foo        testsys/arch=x86_64                   
                                                    testsys/build-id=3ebb33a9             
                                                    testsys/cluster=x86-64-aws-k8s-124    
                                                    testsys/test-type=workload            
                                                    testsys/type=workload                 
                                                    testsys/variant=aws-k8s-1.24          

Testing done:

cli status
 NAME                                    TYPE           STATE             PASSED      FAILED      SKIPPED 
 x86-64-aws-k8s-124-1-initial            Test           passed                 1        6972            0 
 x86-64-aws-k8s-124-2-migrate            Test           passed                 2           0            0 
 x86-64-aws-k8s-124-3-migrated           Test           passed                 1        6972            0 
 x86-64-aws-k8s-124-4-migrate            Test           passed                 2           0            0 
 x86-64-aws-k8s-124-5-final              Test           passed                 1        6972            0 
 x86-64-aws-k8s-124-test                 Test           error                                             
 x86-64-aws-k8s-124                      Resource       completed                                         
 x86-64-aws-k8s-124-instances-lnka       Resource       completed                                         

Terms of contribution:

By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.

@ecpullen ecpullen requested a review from jpmcb March 1, 2023 00:20
@ecpullen ecpullen force-pushed the status branch 2 times, most recently from dbf1ece to 01c2afe Compare March 1, 2023 20:42
Copy link
Contributor

@mjsterckx mjsterckx left a comment

Choose a reason for hiding this comment

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

Looks good to me. These will be very helpful.

@ecpullen ecpullen merged commit bbf8bf6 into bottlerocket-os:develop Mar 11, 2023
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