Skip to content

AzuriteContainer does not map ports. Is it intentional? #875

@ChlorUpload

Description

@ChlorUpload

AzuriteContainer created in PR #860 manually gets ports for blob, queue, and table to expose them like this:

// packages/modules/azurite/src/azurite-container.ts
  this.withCommand(command).withExposedPorts(
      { container: BLOB_PORT, host: this.blobPort },
      { container: QUEUE_PORT, host: this.queuePort },
      { container: TABLE_PORT, host: this.tablePort }
    );

... and makes the connection string like this:

public getBlobPort(): number {
    return this.blobPort;
  }

  public getQueuePort(): number {
    return this.queuePort;
  }

  public getTablePort(): number {
    return this.tablePort;
  }

  /**
   * @returns A connection string in the form of `DefaultEndpointsProtocol=[protocol];AccountName=[accountName];AccountKey=[accountKey];BlobEndpoint=[blobEndpoint];QueueEndpoint=[queueEndpoint];TableEndpoint=[tableEndpoint];`
   */
  public getConnectionString(): string {
    return `DefaultEndpointsProtocol=http;AccountName=${this.accountName};AccountKey=${
      this.accountKey
    };BlobEndpoint=${this.getBlobEndpoint()};QueueEndpoint=${this.getQueueEndpoint()};TableEndpoint=${this.getTableEndpoint()};`;
  }

But this may result in port conflicts. Still GenericContainer already has a port mapping feature for this, so I consider to change like this:

this.withCommand(command).withExposedPorts(BLOB_PORT, QUEUE_PORT, TABLE_PORT);

...

  public getMappedBlobPort(): number {
    return this.getMappedPort(BLOB_PORT);
  }

  public getMappedQueuePort(): number {
    return this.getMappedPort(QUEUE_PORT);
  }

  public getMappedTablePort(): number {
    return this.getMappedPort(TABLE_PORT);
  }

Is this behavior intentional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions