github.com/apache/beam/sdks/v2@v2.48.2/go/test/integration/xlang/expansion_test.go (about) 1 // Licensed to the Apache Software Foundation (ASF) under one or more 2 // contributor license agreements. See the NOTICE file distributed with 3 // this work for additional information regarding copyright ownership. 4 // The ASF licenses this file to You under the Apache License, Version 2.0 5 // (the "License"); you may not use this file except in compliance with 6 // the License. You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 package xlang 17 18 import ( 19 "os" 20 "testing" 21 22 "github.com/apache/beam/sdks/v2/go/pkg/beam/core/runtime/xlangx/expansionx" 23 "github.com/apache/beam/sdks/v2/go/test/integration" 24 ) 25 26 const ( 27 // TODO(https://github.com/apache/beam/issues/21279): Select the most recent Beam release instead of a hard-coded 28 // string. 29 beamVersion = "2.34.0" 30 gradleTarget = ":sdks:java:io:expansion-service:runExpansionService" 31 ) 32 33 func TestAutomatedExpansionService(t *testing.T) { 34 integration.CheckFilters(t) 35 jarPath, err := expansionx.GetBeamJar(gradleTarget, beamVersion) 36 if err != nil { 37 t.Fatalf("failed to get JAR path, got %v", err) 38 } 39 t.Cleanup(func() { os.Remove(jarPath) }) 40 41 serviceRunner, err := expansionx.NewExpansionServiceRunner(jarPath, "") 42 if err != nil { 43 t.Fatalf("failed to make new expansion service runner, got %v", err) 44 } 45 err = serviceRunner.StartService() 46 if err != nil { 47 t.Errorf("failed to start expansion service JAR, got %v", err) 48 } 49 50 err = serviceRunner.StopService() 51 if err != nil { 52 t.Errorf("failed to stop expansion service JAR, got %v", err) 53 } 54 }