github.com/drone/runner-go@v1.12.0/registry/static_test.go (about)

     1  // Copyright 2019 Drone.IO Inc. All rights reserved.
     2  // Use of this source code is governed by the Polyform License
     3  // that can be found in the LICENSE file.
     4  
     5  package registry
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/drone/drone-go/drone"
    11  )
    12  
    13  func TestStatic(t *testing.T) {
    14  	a := &drone.Registry{}
    15  	b := &drone.Registry{}
    16  	p := Static([]*drone.Registry{a, b})
    17  	out, err := p.List(noContext, nil)
    18  	if err != nil {
    19  		t.Error(err)
    20  		return
    21  	}
    22  	if len(out) != 2 {
    23  		t.Errorf("Expect combined registry output")
    24  		return
    25  	}
    26  	if out[0] != a {
    27  		t.Errorf("Unexpected registry at index 0")
    28  	}
    29  	if out[1] != b {
    30  		t.Errorf("Unexpected registry at index 1")
    31  	}
    32  }