Skip to content

Commit

Permalink
Move e2e test files into subpackage
Browse files Browse the repository at this point in the history
Before I add the docker test code from GoogleCloudPlatform/opentelemetry-operations-java#364 to this repo, I wanted to move the e2e test runner code (which is separate to a subpackage). This makes it more explicit what is used for what and simplifies CI a bit.
  • Loading branch information
aabmass committed Sep 4, 2024
1 parent d05ebab commit eade77d
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 go test -c
RUN CGO_ENABLED=0 go test -tags=e2e -c ./e2etestrunner -o opentelemetry-operations-e2e-testing.test

FROM hashicorp/terraform:light as tfbuild
COPY tf /src/tf
Expand Down
6 changes: 3 additions & 3 deletions cmd/testmatrix/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"strings"

"cloud.google.com/go/storage"
e2e_testing "github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner"
"github.com/alexflint/go-arg"
"golang.org/x/sync/errgroup"
"google.golang.org/api/cloudbuild/v1"
Expand Down Expand Up @@ -88,7 +88,7 @@ This will fetch recent Cloud Build logs to automatically update the statuses in
)

type Args struct {
e2e_testing.CmdWithProjectId
e2etestrunner.CmdWithProjectId
}

type status string
Expand All @@ -106,7 +106,7 @@ var (
)

func main() {
args := Args{}
args := e2etestrunner.Args{}
arg.MustParse(&args)

ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletion art.go → e2etestrunner/art.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

const BeginOutputArt = `
Expand Down
4 changes: 2 additions & 2 deletions e2e_testing.go → e2etestrunner/e2e_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"
"time"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

type ApplyPersistent struct {
Expand Down
9 changes: 6 additions & 3 deletions main_test.go → e2etestrunner/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
// Only build as part of e2e tests, not regular go test invocations
//go:build e2e

package e2etestrunner

import (
"context"
Expand All @@ -24,8 +27,8 @@ import (
"testing"
"time"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
"github.com/alexflint/go-arg"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

const cloudFunctionTfDir string = "tf/cloud-functions-gen2"
Expand Down
6 changes: 3 additions & 3 deletions setup_cloud_run.go → e2etestrunner/setup_cloud_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

const cloudRunTfDir string = "tf/cloud-run"
Expand Down
6 changes: 3 additions & 3 deletions setupgae.go → e2etestrunner/setupgae.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

const gaeTfDir string = "tf/gae"
Expand Down
6 changes: 3 additions & 3 deletions setupgaestandard.go → e2etestrunner/setupgaestandard.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

const gaeStandardTfDir string = "tf/gae-standard"
Expand Down
6 changes: 3 additions & 3 deletions setupgce.go → e2etestrunner/setupgce.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

const gceTfDir string = "tf/gce"
Expand Down
6 changes: 3 additions & 3 deletions setupgke.go → e2etestrunner/setupgke.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"log"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
)

const gkeTfDir string = "tf/gke"
Expand Down
6 changes: 3 additions & 3 deletions setuplocal.go → e2etestrunner/setuplocal.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"context"
"fmt"
"log"
"os"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/mount"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"strconv"

"cloud.google.com/go/pubsub"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/setuptf"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/setuptf"
"google.golang.org/genproto/googleapis/rpc/code"
)

Expand Down
7 changes: 5 additions & 2 deletions trace_test.go → e2etestrunner/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
// Only build as part of e2e tests, not regular go test invocations
//go:build e2e

package e2etestrunner

import (
"context"
Expand All @@ -26,7 +29,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/testclient"
"github.com/GoogleCloudPlatform/opentelemetry-operations-e2e-testing/e2etestrunner/testclient"
"github.com/sethvargo/go-retry"
cloudtrace "google.golang.org/api/cloudtrace/v1"
"google.golang.org/genproto/googleapis/rpc/code"
Expand Down
2 changes: 1 addition & 1 deletion util.go → e2etestrunner/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package e2e_testing
package e2etestrunner

import (
"encoding/hex"
Expand Down

0 comments on commit eade77d

Please sign in to comment.