Skip to content

feat: [Gax] Add script to download and generate the showcase client and download the showcase server#9347

Open
Hectorhammett wants to merge 11 commits into
mainfrom
generate-conformance-tests
Open

feat: [Gax] Add script to download and generate the showcase client and download the showcase server#9347
Hectorhammett wants to merge 11 commits into
mainfrom
generate-conformance-tests

Conversation

@Hectorhammett

@Hectorhammett Hectorhammett commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Created a script for downloading and generating the showcase client for the conformance tests. This client was generated a long time ago and we need a consistent way to generate and update the showcase client and server, specially with PQC around the corner.

Closes: #9229

Depends on: googleapis/gapic-generator-php#838

@Hectorhammett
Hectorhammett marked this pull request as ready for review July 16, 2026 22:03
@Hectorhammett
Hectorhammett requested a review from a team as a code owner July 16, 2026 22:03
Comment thread Gax/tests/Conformance/src/V1beta1/Client/TestingClient.php
Comment thread Gax/tests/Conformance/bin/gapic-showcase Outdated
Comment thread Gax/generate-showcase.sh Outdated
@Hectorhammett
Hectorhammett force-pushed the generate-conformance-tests branch from 67b386e to f5c0273 Compare July 20, 2026 21:08
Comment thread Gax/tests/Conformance/README.md Outdated
Comment thread Gax/tests/Conformance/README.md
Comment thread dev/src/Command/ShowcaseGenerateCommand.php
Comment thread Gax/tests/Conformance/src/V1beta1/Test_Blueprint.php Outdated
Comment thread dev/src/Command/GaxGenerateShowcaseCommand.php Outdated
Comment thread dev/src/Command/GaxGenerateShowcaseCommand.php Outdated
Comment thread dev/src/Command/ShowcaseGenerateCommand.php
Comment thread dev/src/Command/GaxGenerateShowcaseCommand.php Outdated
Comment thread dev/src/Command/ShowcaseGenerateCommand.php Outdated
Comment thread dev/src/Command/ShowcaseGenerateCommand.php
Comment thread dev/src/Command/ShowcaseGenerateCommand.php Outdated
Comment thread dev/src/Command/ShowcaseGenerateCommand.php

@cy-yun cy-yun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Thanks for adding this!

@bshaffer bshaffer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Most of what I have is nits - I think we have a lot of opportunities to simplify this.

private string $rootDirectory;
private Filesystem $fs;

public function __construct(string $rootDirectory)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit but everywhere else this is $rootPath

)
->addOption(
'showcase-path',
'p',

@bshaffer bshaffer Jul 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit but, I'd say just make all of the aliases null (except for out-dir), as p and a aren't exactly intuitive

'Gax'
)
->addOption(
'generator-path',

@bshaffer bshaffer Jul 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, can we call this gapic-generator-path?

$outDir = $input->getOption('out-dir');
$targetDir = $this->rootDirectory . trim($outDir, '/');
$conformanceDir = $targetDir . '/tests/Conformance';
$tmpOutputDir = $conformanceDir . '/tmp_out';

@bshaffer bshaffer Jul 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say make this a temporary file in the filesystem, e.g.

Suggested change
$tmpOutputDir = $conformanceDir . '/tmp_out';
$tmpOutputDir = tempnam(sys_get_temp_dir(), 'showcase_out');


$outDir = $input->getOption('out-dir');
$targetDir = $this->rootDirectory . trim($outDir, '/');
$conformanceDir = $targetDir . '/tests/Conformance';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be hardcoded, but rather part of the out-dir by default

Suggested change
$conformanceDir = $targetDir . '/tests/Conformance';

$allProtoFiles = glob($schemaDir . '/*.proto');
$generatorProtoFiles = array_values(array_filter(
$allProtoFiles,
fn ($file) => !str_ends_with($file, 'messaging.proto')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we explicitly excluding the messaging client? Please leave a comment explaining it

Comment on lines +164 to +167
'--descriptor_set_out=' . $descFile,
], $generatorProtoFiles, [
$googleapisPath . '/google/cloud/common_resources.proto',
]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit but, can we just do this?

Suggested change
'--descriptor_set_out=' . $descFile,
], $generatorProtoFiles, [
$googleapisPath . '/google/cloud/common_resources.proto',
]);
'--descriptor_set_out=' . $descFile,
$googleapisPath . '/google/cloud/common_resources.proto'
], $generatorProtoFiles);

Comment on lines +175 to +176

$serviceYaml = file_exists($schemaDir . '/showcase_v1beta1.yaml') ? file_get_contents($schemaDir . '/showcase_v1beta1.yaml') : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can assume it exists... and if we use the filesystem component, it will throw an Exception if it doesn't exist, which would be even better (since we expect it to exist)

Suggested change
$serviceYaml = file_exists($schemaDir . '/showcase_v1beta1.yaml') ? file_get_contents($schemaDir . '/showcase_v1beta1.yaml') : null;
$serviceYaml = $this->fs->readFile($schemaDir . '/showcase_v1beta1.yaml');

Comment on lines +194 to +195
$this->fs->mkdir(dirname($fullPath));
file_put_contents($fullPath, $content);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we stick with using the filesystem component? That will make calling mkdir redundant:

Suggested change
$this->fs->mkdir(dirname($fullPath));
file_put_contents($fullPath, $content);
$this->fs->dumpFile($fullPath, $content);

-1,
false,
MigrationMode::NEW_SURFACE_ONLY
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get some comments or some named parameters here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvements to Showcase conformance tests

3 participants