Skip to content

Commit

Permalink
fix(internal/postprocessor): add missing assignment (googleapis#8646)
Browse files Browse the repository at this point in the history
Added a test so this is actually verified now too.
  • Loading branch information
codyoss authored Oct 4, 2023
1 parent 148878f commit d8c5746
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/postprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func (p *postProcessor) loadConfig() error {
ServiceConfig: v.ServiceConfig,
ImportPath: v.ImportPath,
RelPath: v.RelPath,
ReleaseLevel: v.ReleaseLevelOverride,
}
}
for _, v := range owlBotConfig.DeepCopyRegex {
Expand Down
41 changes: 41 additions & 0 deletions internal/postprocessor/config_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import "testing"

func TestLoadConfig(t *testing.T) {
p := &postProcessor{
googleCloudDir: "../..",
googleapisDir: googleapisDir,
}
if err := p.loadConfig(); err != nil {
t.Fatal(err)
}

li := p.config.GoogleapisToImportPath["google/cloud/alloydb/connectors/v1"]
if got, want := li.ImportPath, "cloud.google.com/go/alloydb/connectors/apiv1"; got != want {
t.Errorf("got %v, want %v", got, want)
}
if got, want := li.ServiceConfig, "connectors_v1.yaml"; got != want {
t.Errorf("got %v, want %v", got, want)
}
if got, want := li.RelPath, "/alloydb/connectors/apiv1"; got != want {
t.Errorf("got %v, want %v", got, want)
}
if got, want := li.ReleaseLevel, "preview"; got != want {
t.Errorf("got %v, want %v", got, want)
}
}

0 comments on commit d8c5746

Please sign in to comment.