...

Source file src/edge-infra.dev/pkg/f8n/warehouse/packagelock/packagelock_test.go

Documentation: edge-infra.dev/pkg/f8n/warehouse/packagelock

     1  package packagelock
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  var (
     8  	lockTestCases = map[string]bool{
     9  		"testdata/package_lock/warehouse-lock-pass.yaml": true,
    10  		"testdata/package_lock/warehouse-lock-fail.yaml": false,
    11  	}
    12  )
    13  
    14  func TestSerializePackageLock(t *testing.T) {
    15  	plr, err := NewRules()
    16  	if err != nil {
    17  		t.Fatal(err)
    18  	}
    19  
    20  	for lockPath, pass := range lockTestCases {
    21  		_, err := plr.ParsePackageLock(lockPath)
    22  		if err != nil && pass {
    23  			t.Errorf("tc should have passed for %s", lockPath)
    24  		}
    25  	}
    26  	if err != nil {
    27  		t.Fatal(err)
    28  	}
    29  }
    30  

View as plain text