func (s) TestStoreWithSingleProvider(t *testing.T) {
	prov, fp := makeProvider(t, fakeProvider1Name, fakeConfig)

	// Push key materials into the provider.
	wantKM, err := loadKeyMaterials()
	if err != nil {
		t.Fatal(err)
	}
	fp.kmCh <- wantKM

	// Get key materials from the provider and compare it to the ones we pushed
	// above.
	ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
	defer cancel()
	gotKM, err := prov.KeyMaterial(ctx)
	if err != nil {
		t.Fatalf("provider.KeyMaterial() = %v", err)
	}
	// TODO(easwars): Remove all references to reflect.DeepEqual and use
	// cmp.Equal instead. Currently, the later panics because x509.Certificate
	// type defines an Equal method, but does not check for nil. This has been
	// fixed in
	// https://github.com/golang/go/commit/89865f8ba64ccb27f439cce6daaa37c9aa38f351,
	// but this is only available starting go1.14. So, once we remove support
	// for go1.13, we can make the switch.
	if !reflect.DeepEqual(gotKM, wantKM) {
		t.Fatalf("provider.KeyMaterial() = %+v, want %+v", gotKM, wantKM)
	}

	// Close the provider and retry the KeyMaterial() call, and expect it to
	// fail with a known error.
	prov.Close()
	if _, err := prov.KeyMaterial(ctx); err != errProviderClosed {
		t.Fatalf("provider.KeyMaterial() = %v, wantErr: %v", err, errProviderClosed)
	}
}
// TestStoreWithSingleProvider creates a single provider through the store and
// calls methods on it.
TestStoreWithSingleProvider creates a single provider through the store and
calls methods on it.
// TestStoreWithSingleProvider creates a single provider through the store and // calls methods on it .
func (s) TestStoreWithSingleProvider(t *testing.T) {
	prov, fp := makeProvider(t, fakeProvider1Name, fakeConfig)
	wantKM, err := loadKeyMaterials()
	if err != nil {
		t.Fatal(err)
	}
	fp.kmCh <- wantKM
	ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
	defer cancel()
	gotKM, err := prov.KeyMaterial(ctx)
	if err != nil {
		t.Fatalf("provider.KeyMaterial() = %v", err)
	}
	if !reflect.DeepEqual(gotKM, wantKM) {
		t.Fatalf("provider.KeyMaterial() = %+v, want %+v", gotKM, wantKM)
	}
	prov.Close()
	if _, err := prov.KeyMaterial(ctx); err != errProviderClosed {
		t.Fatalf("provider.KeyMaterial() = %v, wantErr: %v", err, errProviderClosed)
	}
}
func ( s ) TestStoreWithSingleProvider ( t * testing . T ) { prov , fp := makeProvider ( t , fakeProvider1Name , fakeConfig ) wantKM , err := loadKeyMaterials ( ) if err != nil { t . Fatal ( err ) } fp . kmCh <- wantKM ctx , cancel := context . WithTimeout ( context . Background ( ) , defaultTestTimeout ) defer cancel ( ) gotKM , err := prov . KeyMaterial ( ctx ) if err != nil { t . Fatalf ( " " , err ) } if ! reflect . DeepEqual ( gotKM , wantKM ) { t . Fatalf ( " " , gotKM , wantKM ) } prov . Close ( ) if _ , err := prov . KeyMaterial ( ctx ) ; err != errProviderClosed { t . Fatalf ( " " , err , errProviderClosed ) } }
TestStoreWithSingleProvider creates a single provider through the store and
calls methods on it.
TestStoreWithSingleProvider creates a single provider through the store and calls methods on it .
// Push key materials into the provider. // Get key materials from the provider and compare it to the ones we pushed // above. // TODO(easwars): Remove all references to reflect.DeepEqual and use // cmp.Equal instead. Currently, the later panics because x509.Certificate // type defines an Equal method, but does not check for nil. This has been // fixed in // https://github.com/golang/go/commit/89865f8ba64ccb27f439cce6daaa37c9aa38f351, // but this is only available starting go1.14. So, once we remove support // for go1.13, we can make the switch. // Close the provider and retry the KeyMaterial() call, and expect it to // fail with a known error.